Bug #65635 [Com]: cannot dereference array
Edit report at https://bugs.php.net/bug.php?id=65635&edit=1
ID: 65635
Comment by: cmbecker69 at gmx dot de
Reported by: TorrAB at Yahoo dot com
Summary: cannot dereference array
Status: Open
Type: Bug
Package: Compile Failure
Operating System: Windows XP
PHP Version: 5.5.3
Block user comment: N
Private report: N
New Comment:
> 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>
Previous Comments:
------------------------------------------------------------------------
[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
Thread (3 messages)