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
Post a Comment