Skip to content

Instantly share code, notes, and snippets.

@ekinhbayar
Created May 22, 2016 15:27
Show Gist options
  • Save ekinhbayar/7c5458c726b9daa06def33e9a5d3ecb8 to your computer and use it in GitHub Desktop.
Save ekinhbayar/7c5458c726b9daa06def33e9a5d3ecb8 to your computer and use it in GitHub Desktop.
ELC play time
<?php var_dump(42);
/*
(function () {
"use strict";
function __main() {
var var_0;
var fcall0Target = php_var_dump;
var fcall0Argument0 = new zend_long(42);
var_0 = fcall0Target(fcall0Argument0);
return new zend_long(1);
}
function php_var_dump() {
for (var i = 0; i < arguments.length; i++) {
php_var_dump_inner(arguments[i]);
}
}
function php_var_dump_inner(value) {
if (typeof value === "boolean") {
console.log("bool(" + value + ")");
} else if (value === null) {
console.log("NULL");
} else if (value instanceof zend_long) {
console.log("int(" + value.val + ")");
} else if (value instanceof zend_double) {
if (!Number.isFinite(value.val)) {
console.log("float(" + (value.val < 0 ? "-" : "") + "INF)");
} else if (Number.isNaN(value.val)) {
console.log("float(NAN)");
} else {
console.log("float(" + value.val + ")");
}
} else if (value instanceof zend_string){
console.log('string("' + value + '")');
} else {
throw new Error("Can't handle non-IS_NULL/IS_FALSE/IS_TRUE/IS_LONG/IS_DOUBLE op");
}
}
function zend_long(lval) {
this.val = lval;
}
function zend_double(dval) {
this.val = dval;
}
function zend_string(string) {
this.val = string;
}
__main();
}());
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment