PHP execute data in object inside the array function
Class Person {
public function name( $name) { return $name; }
public function cc() { return 123; }
}
function data() {
return [
'request' => function( ) {
$name = new Person();
return implode('', [ $name->name('na') , $name->cc() ]);
},
'get' => function() : int { return (int) 1230; }
];
}
var_dump( data()["request"]());
// Result: string(5) "na123"
Reference:
https://github.com/PHPWine/PHPVanilla/blob/main/Crud/Vanilla.php
https://github.com/PHPWine/PHPVanilla/tree/main