#34287 [Opn->Bgs]: geting the first letter of a string
| From: | sniper@php.net | Date: | Sun, 28 Aug 2005 14:30:03 +0000 |
| Subject: | #34287 [Opn->Bgs]: geting the first letter of a string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84089@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: Bogus
Bug Type: MySQL related
Operating System: Win XP
PHP Version: 5CVS-2005-08-28 (CVS)
New Comment:
Works fine.
Previous Comments:
------------------------------------------------------------------------
[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