3v4l.org

run code in 300+ PHP versions simultaneously
<?php // declared in controller... $data = [ 'a' => -1.5, 'b' => false, 'c' => null, 'd' => 'stringy "string" thing', 'e' => range(3,10), 'f' => "0", 'g' => (object)['food' => 'bard'], 'h' => "not used", ]; // the CodeIgniter effect... extract($data); // in your view... $portToJS = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; echo "\n<script>\nlet "; foreach ($portToJS as $i => $variable) { echo (!$i ? '' : ",\n\t") , "{$variable} = " , json_encode(${$variable}); } echo ";\n</script>";
Output for git.master, git.master_jit, rfc.property-hooks
<script> let a = -1.5, b = false, c = null, d = "stringy \"string\" thing", e = [3,4,5,6,7,8,9,10], f = "0", g = {"food":"bard"}; </script>

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:
15.12 ms | 405 KiB | 5 Q