|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-28 14:12 UTC] 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...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 27 18:00:01 2025 UTC |
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...