Re: Looping?

From: Date: Fri, 14 Dec 2001 12:56:48 +0000
Subject: Re: Looping?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77733@lists.php.net to get a copy of this message
At 01:37 PM 12/14/2001 +0100, Tony Arnold wrote:
start('10');
    html-code... I want this to be repeated 10 times.
end(); This doesn't work but this is how I want it! :-) Anyone?
How about using alternate syntax? For example: <? for ($i=0; $i < 10; $i++): ?>
        html-code
<? endfor; ?> http://www.php.net/manual/en/control-structures.alternative-syntax.php Alternatively, this COULD work, but I haven't tested it: function start($loopcount) {
        eval("for (\$i; \$i < $loopcount; \$i++) {");
} function end() {
        eval("}");
} http://www.php.net/manual/en/function.eval.php

« previous php.general (#77733) next »