Edit report at https://bugs.php.net/bug.php?id=65635&edit=1
ID: 65635 Updated by: ni...@php.net Reported by: TorrAB at Yahoo dot com Summary: cannot dereference array -Status: Open +Status: Not a bug Type: Bug Package: Compile Failure Operating System: Windows XP PHP Version: 5.5.3 Block user comment: N Private report: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Correct, this is not a bug. In string interpolation use either "... $array[key] ..." or "... {$array['key']} ...". Previous Comments: ------------------------------------------------------------------------ [2013-09-08 21:31:40] cmbecker69 at gmx dot de > Apparently, the parser cannot dereference $Apt['Color']. No. The parser won't just accept this syntax. See the manual[1] on how to use array indexes in strings. IMHO, this is not a bug. [1] <http://www.php.net/manual/en/language.types.string.php#language.types.string.pars ing.simple> ------------------------------------------------------------------------ [2013-09-08 18:57:46] TorrAB at Yahoo dot com Description: ------------ Parse error: syntax error, unexpected "(T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING). Apparently, the parser cannot dereference $Apt['Color']. May be linked to bug 23022. But why the <unexpected ">? Test script: --------------- <?php #No error, using intermediate var $Colo: forEach ($GLOBALS['Aps'] as $GLOBALS['X'] => $Apt){ $Colo=$Apt['Color']; echo "<div class='row' style=\"background-color: $Colo\">"; echo '</div>';} #Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\Apache24\htdocs\GoodBadB.php on line 10: forEach ($GLOBALS['Aps'] as $GLOBALS['X'] => $Apt){ echo "<div class='row' style=\"background-color: $Apt['Color']\">"; #Apparently, the parser cannot dereference $Apt['Color']. May be linked to bug 23022. But why the <unexpected ">? echo '</div>';} ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65635&edit=1