mirror of
https://github.com/kanaka/mal.git
synced 2024-09-21 02:27:10 +03:00
Merge pull request #325 from chr15m/php-interop-language-constructs
PHP: Wrap some native "language constructs".
This commit is contained in:
commit
ba36c146bd
@ -52,6 +52,22 @@ function _to_native($name, $env) {
|
||||
$res = call_user_func_array($name, $args);
|
||||
return _to_mal($res);
|
||||
});
|
||||
// special case for language constructs
|
||||
} else if ($name == "print") {
|
||||
return _function(function($value) {
|
||||
print(_to_php($value));
|
||||
return null;
|
||||
});
|
||||
} else if ($name == "exit") {
|
||||
return _function(function($value) {
|
||||
exit(_to_php($value));
|
||||
return null;
|
||||
});
|
||||
} else if ($name == "require") {
|
||||
return _function(function($value) {
|
||||
require(_to_php($value));
|
||||
return null;
|
||||
});
|
||||
} else if (in_array($name, ["_SERVER", "_GET", "_POST", "_FILES", "_REQUEST", "_SESSION", "_ENV", "_COOKIE"])) {
|
||||
$val = $GLOBALS[$name];
|
||||
} else if (defined($name)) {
|
||||
|
Loading…
Reference in New Issue
Block a user