home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomePHP CookbookSearch this book

6.11. Calling Variable Functions

6.11.2. Solution

Use variable variables:

function eat_fruit($fruit) { print "chewing $fruit."; }

$function = 'eat_fruit';
$fruit = 'kiwi';

$function($fruit); // calls eat_fruit( )

6.11.4. See Also

Recipe 5.5 for more on variable variables.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.