|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-11 12:09 UTC] aharvey@php.net
-Status: Open
+Status: Bogus
-Package: Output Control
+Package: Strings related
[2011-07-11 12:09 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 09:00:01 2025 UTC |
Description: ------------ the substr(string,from,to) failed and return something i find strange, and never seen it before.. my version is also 5.3.5 but i chose 5.3.6 because the 5.3.5 is not there. Test script: --------------- $x=1; while ($x<=strlen("hello")) { $xx=$x-1; echo substr("hello",$xx,$x); $x++; } echo "<br/>"; $x=1; while ($x<=strlen("hello")) { $xx=$x-1; echo $xx." "; echo $x." "; echo substr("hello",$xx,$x); echo "<br/>"; $x++; } Expected result: ---------------- i expect a result saying: hello 0 1 h 1 2 e 2 3 l 3 4 l 4 5 o like in substr("hello",0,1) substr("hello",1,2) and continue like that. Actual result: -------------- the actual result is: hellloloo 0 1 h 1 2 el 2 3 llo 3 4 lo 4 5 o like substr("hello",1,2) is "el" how can that be? and substr("hello",2,3) is "llo" and how can that be too?