3v4l.org

run code in 300+ PHP versions simultaneously
<?php function var_import($var) { if (strcasecmp($var, 'null') === 0) { return null; } if (strcasecmp($var, 'true') === 0) { return true; } if (strcasecmp($var, 'false') === 0) { return false; } if ($var === ((string) (int) $var)) { return (int) $var; } if ($var === ((string) (float) $var)) { return (float) $var; } return (string) $var; } foreach ([ '1', '2.3', 'true', 'FALSE', 'Null', 'foobar', ] as $var) { ob_start(); var_dump(var_import($var)); echo sprintf('"%s" => %s', $var, trim(ob_get_clean())) . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
"1" => int(1) "2.3" => float(2.3) "true" => bool(true) "FALSE" => bool(false) "Null" => NULL "foobar" => string(6) "foobar"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.25 ms | 401 KiB | 8 Q