rsalumpit Posted July 20, 2009 Share Posted July 20, 2009 $POINT = "foobar"; Function foobar($how_bar); { Echo "not just foobar, $how_bar foobar."; } How can you call the function foobar("really"); without directly calling the function foobar. Hint (use $POINT ); my answer is this but i dont think is correct echo $POINT.'("really");'; Link to comment https://forums.phpfreaks.com/topic/166595-solved-tricky-php-question/ Share on other sites More sharing options...
Alex Posted July 20, 2009 Share Posted July 20, 2009 edit Link to comment https://forums.phpfreaks.com/topic/166595-solved-tricky-php-question/#findComment-878455 Share on other sites More sharing options...
rsalumpit Posted July 20, 2009 Author Share Posted July 20, 2009 How can you call the function foobar("really"); without directly calling the function foobar. Answer: You can't. really?wow thats wierd Link to comment https://forums.phpfreaks.com/topic/166595-solved-tricky-php-question/#findComment-878457 Share on other sites More sharing options...
Alex Posted July 20, 2009 Share Posted July 20, 2009 Whoops, my fault. I read that wrong.. I'm tired it's after 4am Use Eval() Here's an example: <?php $function = 'foobar'; function foobar() { echo 'foobar'; } eval($function . '();'); ?> Link to comment https://forums.phpfreaks.com/topic/166595-solved-tricky-php-question/#findComment-878458 Share on other sites More sharing options...
rsalumpit Posted July 20, 2009 Author Share Posted July 20, 2009 Whoops, my fault. I read that wrong.. I'm tired it's after 4am Use Eval() Here's an example: <?php $function = 'foobar'; function foobar() { echo 'foobar'; } eval($function . '();'); ?> wow thnx it works thatnk man..god bless!!! Link to comment https://forums.phpfreaks.com/topic/166595-solved-tricky-php-question/#findComment-878459 Share on other sites More sharing options...
GingerRobot Posted July 20, 2009 Share Posted July 20, 2009 You don't need to use eval: $POINT = "foobar"; Function foobar($how_bar) { Echo "not just foobar, $how_bar foobar."; } $POINT('really'); However, next time you have a homework question, I suggest you present it as such. People will still help you, as long as you're not after a direct solution. Link to comment https://forums.phpfreaks.com/topic/166595-solved-tricky-php-question/#findComment-878463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.