Re: check if a foreach loop has successfully run

From: Date: Tue, 25 Jun 2002 14:22:05 +0000
Subject: Re: check if a foreach loop has successfully run
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-103781@lists.php.net to get a copy of this message
"Jule Slootbeek" <jslootbeek@clarku.edu> wrote in message news:3D187BBF.3060900@clarku.edu... > > if (foreach ($answer as $a) { echo $a }) > { > return TRUE; > } else { > return FALSE; > } Seems about right, however by default output is printed to a Page unless you are running your script in the command prompt what you might want to do to avoid messiness is redirect every printout confirmation of your for loop to the std.error (I am not too sure what the path is: it should be in the manuals though - php.net)... Or alternatively to a file using the fopen(fileName, "w+"); then using puts() or fwrite to write the output contents... Spike...

« previous php.general (#103781) next »