foreach() or for()

From: Date: Tue, 25 Mar 2003 06:41:02 +0000
Subject: foreach() or for()
Groups: php.general 
Request: Send a blank email to php-general+get-140921@lists.php.net to get a copy of this message
How Do, All? Here's one unsuccessful attempt to add each $val during a for: <? for ($z = 0;$z < count($val);$z++) { $v = $val + $val; } print 'Total?: '.$v.'<br>'; ?> Conversely I need to isolate certain elements oof a foreach: <? foreach($var as $v){ if ($v != 'argument') { //add all the $v's for a total } ?> Thank you! -- Richard Whitney * Transcend Development Producing the next phase of your internet presence. rw@xend.net * http://xend.net * 602-971-2791 * * * * * *__ * * _/ \___ * * / * \* * */ * * \ * */\_ |\ / \_ / \ / \____/ \ / \ / \ / \

« previous php.general (#140921) next »