note 107501 deleted from control-structures.for by danbrown

From: Date: Thu, 10 May 2012 20:56:10 +0000
Subject: note 107501 deleted from control-structures.for by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187848@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- 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; ?>

« previous php.notes (#187848) next »