2.3445, M_PI\n"; process(2.3445, M_PI, $farr); / / now make a bunch of string processing functions $garr = array (create_function('$b,$a' ,'if (strncmp($a,$b,3) == 0) return "** \"$a\ "'. 'and \"$b\"\n** Look the same to me! (looking at the first 3 chars)" ;'), create_function('$a,$b' ,'; return "CRCs: ".crc32($a).", ".crc32(b) ;'), create_function('$a,$b' ,'; return "similar(a,b) = ".similar_text($a,$b, $p) ."($p%)" ;')); echo "\nUsing the second array of anonymous functions\n"; process("Twas brilling and the slithy toves", "Twas the night", $garr);
예 2. Making a general processing function with create_function()