php - JSON foreach error to get name -


i´ve got following errormessage:

parse error: syntax error, unexpected t_double_arrow, expecting t_paamayim_nekudotayim in /var/www/createrecipeing.php on line 60 

don´t know how handle that, never had before.

here´s code:

$ings =  array(); $ings = json_decode($incr_arr, true); print_r($ings); $reid = 5;  foreach ($ings['data']['recipes']['recipe_' . $reid] key => $shing){     echo $shing['name']; } 

line 60 line foreach loop. know error must there because values of $ings correct.

how can manage this?

you need define element key other variable.

you declared key when should $key.

check php manual future reference.

code fix

foreach ($ings['data']['recipes']['recipe_' . $reid] $key => $shing){     echo $shing['name']; } 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -