note 40407 rejected from function.substr by vincent

From: Date: Wed, 03 Mar 2004 11:49:35 +0000
Subject: note 40407 rejected from function.substr by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66157@lists.php.net to get a copy of this message
Note Submitter: jordan@codedemons.net ---- If you are only trying to get ONE letter, using $var[4] is actaully faster than substr($var,4,1). I am confused as to why this is, because it makes sense that converting the string to an array will be slow. But, it has been confirmed in a 100 000 trial test, with strings ranging in length from 1 to 100 000 characters. If anyone knows why this is true, please let me know.

« previous php.notes (#66157) next »