Anonymous functions are available from PHP 5.3.
Should I use them or avoid them? If so, how?
Edited; just found some nice trick with php anonymo
Here is sample example of using using anonymous functions in Php
$suppliers=['add1'=>'nodia','add2'=>'delhi', 'add3'=>'UP'];
$getAddress = function($suppliers){ $address=[];
for($i=1;$i<5;$i++){
if(array_key_exists('add'.$i, $suppliers))
$address[]=$suppliers['add'.$i];
}
return $address;};
print_r($getAddress($suppliers));
In above example we have written anonymous functions that check if a key exists in inputted array. If it exists then it will put that into output array.