#24494 [Opn->Bgs]: incorrect value for texte in array
| From: | jay@php.net | Date: | Fri, 04 Jul 2003 15:14:03 +0000 |
| Subject: | #24494 [Opn->Bgs]: incorrect value for texte in array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43272@lists.php.net to get a copy of this message | ||
ID: 24494
Updated by: jay@php.net
Reported By: bibifoc23 at yahoo dot fr
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: all
PHP Version: 4.3.2
New Comment:
This is expected behaviour, I believe. $array['TM'] is not
an array, it's a string, but strings can be treated like
arrays. So 'TM' gets converted to 0 given PHP's type
juggling rules, and $array['TM'][0] is 't', so it's
working as expected.
J
Previous Comments:
------------------------------------------------------------------------
[2003-07-04 08:08:05] bibifoc23 at yahoo dot fr
Description:
------------
hello,
I get strange behaviour with array:
<?php
$array = array ( 'TM' => 'test', 'autre dossier' =>
'texte' ) ;
print_r ( $array );
echo $array['TM']['TM']."\n";
?>
the echo command return the first character of string. But $array['TM']
is not an array, so i expext to have an error wen i call
$array['TM']['TM'].
But PHP convert the second index to 0.
Thanks
Reproduce code:
---------------
<?php
$array = array ( 'TM' => 'test', 'autre dossier' =>
'texte' ) ;
print_r ( $array );
echo $array['TM']['TM']."\n";
?>
Expected result:
----------------
return error or warning.
Actual result:
--------------
return the first character of the string
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24494&edit=1