#34287 [NEW]: geting the first letter of a string
| From: | stuk88 at gmail dot com | Date: | Sun, 28 Aug 2005 12:12:04 +0000 |
| Subject: | #34287 [NEW]: geting the first letter of a string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-84085@lists.php.net to get a copy of this message | ||
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<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 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