#22892 [Opn->Bgs]: Using a string as an Array parameter

From: Date: Wed, 26 Mar 2003 15:26:07 +0000
Subject: #22892 [Opn->Bgs]: Using a string as an Array parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-36495@lists.php.net to get a copy of this message
ID: 22892 Updated by: edink@php.net Reported By: jorgen at webstores dot nl -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Windows XP PHP Version: 4.3.2RC1 New Comment: Your have mistaken two different meanings of [] operator which can mean both string offset (as is in your example) and array. For this reason the use of [] has been discouraged for some time and {} has been introduced as the replacement for the case of accessing string characters. Previous Comments: ------------------------------------------------------------------------ [2003-03-26 04:34:54] jorgen at webstores dot nl <?php $var = 'ABC'; echo ($var[0]); // Displays 'A' echo ($var[1]); // Displays 'B' echo ($var[2]); // Displays 'C' echo join(" ", $var); // Wont work ?> Do you get my point? One can call a 'string' variable as an Array, but one can not use that same 'string' as an Array parameter. Seems a little bit odd to me... Because I want to display: 'ABC' as 'A B C', would this be very handy. Kind regards, Jorgen Horstink ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22892&edit=1

« previous php.bugs (#36495) next »