Req #45085 [Opn->Csd]: {} is better than [] for string access

From: Date: Fri, 13 Apr 2012 20:30:21 +0000
Subject: Req #45085 [Opn->Csd]: {} is better than [] for string access
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169556@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45085&edit=1 ID: 45085 Updated by: nikic@php.net Reported by: noah at dizzler dot com Summary: {} is better than [] for string access -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues PHP Version: 6CVS-2008-05-24 (CVS) -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: Closing this as PHP 6 doesn't exist anymore and {} is not deprecated in 5.4. Previous Comments: ------------------------------------------------------------------------ [2008-05-24 01:00:22] noah at dizzler dot com Description: ------------ I am very upset that {} string access is being depreciated in PHP 6. $foo = 'bar'; $foo{2} = 't'; In my opinion... $foo{2} is MUCH easier to read and understand while developing, because you know exactly what it means, $foo[2] is ambiguous to read, and problematic during development because $foo could be an array or a string, and in either case the code will execute without errors or notices if $foo is not the vartype you intended it to be. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=45085&edit=1

« previous php.bugs (#169556) next »