-4

I know this should be a relatively simple thing but I have not been able to do it yet. I have look hi and low and every example I try it fails I am sure it is fairly simple

Here is my array. I need to get the value of name last and filenames Any help would be most appreciated.

Thanks!!

Array ( [formData] => Array ( [name] => TEST [last] => TEST1 [filenames] => Array ( [0] => /ocdata/uploads/export-1511887767.csv ) ) ) 
5
  • 1
    Working with arrays is php basics. Read a manual please, everything is described there. Commented Nov 30, 2017 at 16:51
  • Are you looking for $formData['name'] and $formData['filenames'][0]? Commented Nov 30, 2017 at 16:52
  • $name = $array['formData']['name']; ? Commented Nov 30, 2017 at 16:53
  • 3
    You looked high and low and couldn't find out how to access an array index? Commented Nov 30, 2017 at 16:54
  • 1
    @MCMXCII cuz it is in the middle? Commented Nov 30, 2017 at 16:54

1 Answer 1

-2

Really simple method to see your content:

foreach($array as $k => $v) { echo $k . $v . PHP_EOL; // see content of your array } 

Or use directly the values:

$array['formData']['name']; $array['formData']['last']; $array['formData']['filenames']; 
Sign up to request clarification or add additional context in comments.

4 Comments

Doesn't really answer the question and Notice: Array to string conversion
While this may answer the question in a way, the answer could be majorly improved by showing OP the proper way to do it, vs "just a way". If it generates a notice or an error, it's not the right way. Teach a man to fish and all that....
Thanks everyone your answer were correct sorry it was a completely different issue that was haunting me. It had nothing to do with the array once I figured it out (i cannot even remember what it was) everything worked fine.
Well I’m glad I helped anyway.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.