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


Book HomePHP CookbookSearch this book

6.13. Creating Dynamic Functions

6.13.2. Solution

Use create_function( ):

$add = create_function('$i,$j', 'return $i+$j;');

$add(1, 1); // returns 2

6.13.4. See Also

Recipe 4.18 for information on usort( ); documentation on create_function( ) at http://www.php.net/create-function and on usort( ) at http://www.php.net/usort.



Library Navigation Links

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