Re: Looping?
| From: | Michael Sims | 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');How about using alternate syntax? For example: <? for ($i=0; $i < 10; $i++): ?>html-code... I want this to be repeated 10 times.end(); This doesn't work but this is how I want it! :-) Anyone?
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