note 100346 added to function.substr
| From: | joseph dot davidson dot 707 at gmail dot com | Date: | Sat, 09 Oct 2010 19:58:35 +0000 |
| Subject: | note 100346 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173106@lists.php.net to get a copy of this message | ||
Using substr() to examine characters of a string without altering the string.
$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.
----
Server IP: 208.69.120.55
Probable Submitter: 67.174.228.162
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/100346
Del: integrated -- https://master.php.net/note/delete/100346/integrated
Del: useless -- https://master.php.net/note/delete/100346/useless
Del: bad code -- https://master.php.net/note/delete/100346/bad+code
Del: spam -- https://master.php.net/note/delete/100346/spam
Del: non-english -- https://master.php.net/note/delete/100346/non-english
Del: in docs -- https://master.php.net/note/delete/100346/in+docs
Del: other reasons-- https://master.php.net/note/delete/100346
Reject -- https://master.php.net/note/reject/100346
Search -- https://master.php.net/manage/user-notes.php