PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, May 11, 2022

[FIXED] How do I access to my variable in an array of array of array?

 May 11, 2022     arrays, file, php, symfony, variables     No comments   

Issue

I want to access to 'image'

enter image description here

I reached my array 'questions' with this $file = $request->files->get('quiz')['questions']; but I can't go further

Can you help me please


Solution

Based on your screen shot you could,

$image = $request->files->get('quiz')['questions'][0]['image'];

Each nested level is an array so you can walk all the way down using the array keys.

Note that [0] will be the first question, but you probably want all the questions. If so, you can loop over them.

foreach ($request->files->get('quiz')['questions'] as $question) {
    $image = $question['image'];
    //
}


Answered By - waterloomatt
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing