note 107501 added to control-structures.for
| From: | Anonymous | Date: | Tue, 14 Feb 2012 03:49:18 +0000 |
| Subject: | note 107501 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186113@lists.php.net to get a copy of this message | ||
Regarding [kanirockz at gmail dot com 21-Mar-2010 11:48]; here's a more compact form of your
program and for loop:
<?php
$lentxt=strlen($text="Welcome to PHP");
$searchchar="e";
for($i=0, $count=0; $i<$lentxt; substr($text,$i++,1)==$searchchar ? $count++ : NULL);
echo $count;
?>
----
Server IP: 69.147.83.197
Probable Submitter: 72.219.151.91
----
Manual Page -- http://www.php.net/manual/en/control-structures.for.php
Edit -- https://master.php.net/note/edit/107501
Del: integrated -- https://master.php.net/note/delete/107501/integrated
Del: useless -- https://master.php.net/note/delete/107501/useless
Del: bad code -- https://master.php.net/note/delete/107501/bad+code
Del: spam -- https://master.php.net/note/delete/107501/spam
Del: non-english -- https://master.php.net/note/delete/107501/non-english
Del: in docs -- https://master.php.net/note/delete/107501/in+docs
Del: other reasons-- https://master.php.net/note/delete/107501
Reject -- https://master.php.net/note/reject/107501
Search -- https://master.php.net/manage/user-notes.php