Let's assume, we have an array with anonymous functions as values. It has following contents:
$fpool = [
'f1' => function($a){
if($a > 0){
return [$a*$a, $a+$a];
}
return 0;
},
'f2' => function($a){
if($a > 0){
return [$a*3, $a+2];
}
return 1;
}
];
I want to take some values and save them to separate file without copy/paste.
Is it possible for example to save $fpool['f2']
to separate file for later include?
The file to include must have followng content:
<?php
return ['f2' => function($a){....}]
Because its a closure I can't serialize()
or do var_export()