Dynamic function calls within the echo function, possible?
| From: | XeRnOuS ThE | Date: | Mon, 19 Jul 2004 23:55:13 +0000 |
| Subject: | Dynamic function calls within the echo function, possible? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-191089@lists.php.net to get a copy of this message | ||
Yo, i run some fairly simplistic sites, and still don't know to much PHP.
Anyways i have this function called row color, it works fairly simply.
$row1 = "bgcolor='#c0c0c0'";
$row2 = "bgcolor='#808080'";
function row_color(&$row_color=null)
{
static $row_count=0;
$row_color = ($row_count % 2) ? $GLOBALS['row1'] : $GLOBALS['row2'];
$row_count++
return $row_color;
}
what i want to do, is somehow dynamicly call that funciton within an echo or print function though.
something like
$row = "row_color";
echo "$row()<br>$row()<br>$row()";
but i cant seem to find a way to properly do this. That just returns null values, i have been screwing around with it for about a week now, and another two weeks trying to get it working on classes, but i cant figure out if it is even possible to do.
The idea bewteen the &$row_color is so that i can optionally use referencing on other places in the scripts i have.
-XeRnOuS
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/