I am having the following friendDetails array output,
Array
(
[0] => Array
(
[id] => 1
[first_name] => Aruun
[last_name] => Sukumar
[photo] => jpg
)
[1] => Array
(
[id] => 2
[first_name] => senthilkumar
[last_name] => Kumar
[photo] => jpg
)
)
I use the following piece of code to to get final output
foreach($friendDetails as $value){
array_push($friendList, $value[id].".".$value[photo]."-".$value[first_name]." ".$value[last_name]);
}
Final output will be,
Array
(
[0] => 1.jpg-Aruun Sukumar
[1] => 2.jpg-senthilkumar Kumar
[2] => 18.jpg-senthilkumar sugumar
)
Here I am getting Notice Error with exact output. What i done wrong on the code?
Is there any other way to get Final Output ?
You get the notice error as you are not putting the keys of your array in quotes.
It should be:
see http://php.net/manual/en/language.types.array.php