TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
452 B
22 lines
452 B
<?php
|
|
$operator = PyCore::import("operator");
|
|
$builtins = PyCore::import("builtins");
|
|
|
|
function invert_dictionary($obj) {
|
|
return (function() {
|
|
$___ = [];
|
|
$___iter = $obj->items();
|
|
foreach($___iter as $___i => [$key, $value]) {
|
|
$___[] = [$key, $value];
|
|
}
|
|
return $___;
|
|
})();
|
|
}
|
|
|
|
|
|
$ages = new PyDict([
|
|
"Peter" => 10,
|
|
"Isabel" => 11,
|
|
"Anna" => 9,
|
|
]);
|
|
invert_dictionary($ages);
|
|
|