note 41227 modified in function.echo by aidan

From: Date: Sun, 27 Jun 2004 13:55:41 +0000
Subject: note 41227 modified in function.echo by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71903@lists.php.net to get a copy of this message
If using an optional function you can decide which function to be included, this is helpful for deciding the style of the row being used: <?php $array = array( "Number one" , "Number two" , "Number three" ); $count = count($array); for($i=0;$count>$i;$i++) { $style = $count ? 'style1' : 'style2'; echo "<div class='{$style}'>{$array[$i]}</div>"; } ?> But arrays must always have {} around them, including many variables --was-- If using an optional function you can decide which function to be included, this is helpful for deciding the style of the row being used: <?PHP $array = array( "Number one" , "Number two" , "Number three" ); $count = count($array); for($i=0;$count>$i;$i++){ $style = $count ? 'style1' : 'style2'; echo "<div class='{$style}'>{$array[$i]}</div>"; } ?> But arrays must always have {} around them, including many variables http://php.net/manual/en/function.echo.php

« previous php.notes (#71903) next »