#34287 [Opn->Fbk]: geting the first letter of a string

From: Date: Sun, 28 Aug 2005 18:09:38 +0000
Subject: #34287 [Opn->Fbk]: geting the first letter of a string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84100@lists.php.net to get a copy of this message
ID: 34287 Updated by: sniper@php.net Reported By: stuk88 at gmail dot com -Status: Open +Status: Feedback Bug Type: MySQL related Operating System: Win XP PHP Version: 5CVS-2005-08-28 (CVS) New Comment: Then provide a reproducing script that actually does NOT work for you!! The lines you provided work just fine. Previous Comments: ------------------------------------------------------------------------ [2005-08-28 18:46:32] stuk88 at gmail dot com 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... ------------------------------------------------------------------------ [2005-08-28 16:30:01] sniper@php.net 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<br>"; 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

« previous php.bugs (#84100) next »