#34287 [Bgs->Opn]: geting the first letter of a string
ID: 34287 User updated by: stuk88 at gmail dot com Reported By: stuk88 at gmail dot com -Status: Bogus +Status: Open Bug Type: MySQL related Operating System: Win XP PHP Version: 5CVS-2005-08-28 (CVS) New Comment: it dosent... i used a mysql result array var and i tryed to see the first letter and it doesnt worked with {0} and the substr($var['title'], 1, 2); (for exsamle) returned the first letter but the substr($var['title'], 0, 1); didnt... Previous Comments: [2005-08-28 16:30:01] [EMAIL PROTECTED] Works fine. [2005-08-28 14:12:03] stuk88 at gmail dot com Description: When i try to see the first letter of a string on php5 like $var{0} - it returns an empty string... and when i use substr i need to start the string from 1 (not 0) and finish on 2 (not 1) - is it a bug or a php 5 improvment? it seems to be a problem in all the php 5 based servers Reproduce code: --- $var = "my name is stas"; echo $var{0}; or $var = "my name is stas"; echo substr($var,0,1); Expected result: m m Actual result: -- ---nothing--- its showing an empty page with nothing in it and just when i use the substr with the first letter 1 and end 2 its returns me the right thing... -- Edit this bug report at http://bugs.php.net/?id=34287&edit=1
#34287 [NEW]: geting the first letter of a string
From: stuk88 at gmail dot com Operating system: Win XP PHP version: 5CVS-2005-08-28 (CVS) PHP Bug Type: MySQL related Bug description: geting the first letter of a string Description: When i try to see the first letter of a string on php5 like $var{0} - it returns an empty string... and when i use substr i need to start the string from 1 (not 0) and finish on 2 (not 1) - is it a bug or a php 5 improvment? it seems to be a problem in all the php 5 based servers Reproduce code: --- $var = "my name is stas"; echo $var{0}; or $var = "my name is stas"; echo substr($var,0,1); Expected result: m m Actual result: -- ---nothing--- its showing an empty page with nothing in it and just when i use the substr with the first letter 1 and end 2 its returns me the right thing... -- Edit bug report at http://bugs.php.net/?id=34287&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34287&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34287&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34287&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=34287&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=34287&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34287&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34287&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34287&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34287&r=support Expected behavior: http://bugs.php.net/fix.php?id=34287&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34287&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34287&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=34287&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34287&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=34287&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34287&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34287&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34287&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34287&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34287&r=mysqlcfg