This is an error 404
There are `0` results
preferences:
143.06 ms | 1399 KiB | 7 Q<?php
function struct(string $name, array $class) {
$class = json_encode($class);
define($name, $class);
}
function create($class) {
$object = (array) json_decode($class);
//if(function_exists($object['__construct']())) $object['__construct']($object);
return $object;
}
function call(array &$class, string $member, ...$args) {
if(!isset($class[$member])) exit($member.' is not a member of the class.');
else {
if(!isset($args[0])) $class[$member]($class);
else $class[$member]($class, $args);
}
}
struct('myStruct', [
'foo' => 'Hello World!',
'bar' => function (array &$this) {
echo(' Hi!');
}
]);
$obj = create(myStruct);
call($obj, 'bar');