3v4l.org

run code in 300+ PHP versions simultaneously
<?php function var_export_2($thing) { $code1 = var_export($thing, true); $code2 = ''; $tokens = token_get_all('<?php ' . $code1); for ($i = 0, $imax = count($tokens); $i < $imax; $i++) { $token = $tokens[$i]; switch ($token[0]) { case '(': $token = '['; break; case ')': $token = ']'; break; case T_ARRAY: $i++; continue 2; case T_OPEN_TAG: continue 2; } $code2 .= is_array($token) ? $token[1] : $token[0]; } return $code2; } echo var_export_2(['a', 'b', 'c', 'd' => ['e', 'f', 'g' => [1, 2, 3]]]);
Output for git.master, git.master_jit, rfc.property-hooks
[ 0 => 'a', 1 => 'b', 2 => 'c', 'd' => [ 0 => 'e', 1 => 'f', 'g' => [ 0 => 1, 1 => 2, 2 => 3, ], ], ]

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