NYCPHP Meetup

NYPHP.org

[nycphp-talk] Inline Functions

Scott Mattocks scott at crisscott.com
Wed Sep 1 14:55:34 EDT 2004


Mark Armendariz wrote:

> I've been stumped by a question of a fellow freelancer today.  Anyone know
> if it's possible in php to do something like this:
> 
> usort($array, function($a, $b) {
>      if($a == $b) return 0;
>      return ($a < $b) ? -1 : 1;
> });

Yes but you have to use the create_function function.
See the manual: http://us2.php.net/manual/en/function.create-function.php

Scott Mattocks



More information about the talk mailing list