Undocumented String Access
- Hi all,
String in PHP are considered as Immutable, that means when you change
a string a completely new string is created and allocated in memory.
But this is not 100 percent true. Here is an undocumented way to
access string directly as well as to modify it. In this way a string
variable could be considered as a character array.
$str = "Hello World";
echo $str; //This will print 'H'
$str = "";
echo $str; //This will print "Hell World" , note that 5th char is null.