The first argument to create_function() is a list of variables for the arguments that will be passed to it, which is why you'll generally use single quotes around it instead of double quotes, as you do not want to evaluate the variables at that time. (You could use double quotes and escape the dollar signs with back-slashes if you really wanted, I suppose.) So the '$a, $b' argument says that the function is expecting to receive two arguments (which will be two array element values to be compared). The usort() code using the create_function could alternatively have been written as follows, using a separate, named callback function:
function mysort($a, $b)
{
return($a['age'] - $b['age']);
}
usort($array, 'mysort');
The advantage of using the create_function() within the usort instead of defining a separate function is that you have one less user-defined function lying around for which you need to think of a unique name, and it keeps everything together on one line. The disadvantage is that it keeps everything together on one line, potentially making the code a bit harder to read and therefore maintain. Off-hand, I don't know if either method has a performance advantage over the other.