note 100346 deleted from function.substr by peehaa

From: Date: Mon, 28 Nov 2016 20:00:46 +0000
Subject: note 100346 deleted from function.substr by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207727@lists.php.net to get a copy of this message
Note Submitter: joseph dot davidson dot 707 at gmail dot com ---- Using substr() to examine characters of a string without altering the string. <?php $string = 'This is my string'; $length = strlen($string); $myChar = 'm'; for($i = 0; $i < $length; $i++) { $showString_i = substr($string, $i, 1); if($myChar == $showString_i) return $i; } ?> can also examine subs.

« previous php.notes (#207727) next »