RE: [PHP] Dynamic function calls within the echo function, possible?

From: Date: Tue, 20 Jul 2004 00:08:14 +0000
Subject: RE: [PHP] Dynamic function calls within the echo function, possible?
Groups: php.general 
Request: Send a blank email to php-general+get-191090@lists.php.net to get a copy of this message
[snip] 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. [/snip] Does $row = row_color($passTheRowDataThatNeedsPassing); not work?

« previous php.general (#191090) next »