3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g($a, $b, $c) { f($a, $b, $c); } function f(int $a, int $b = null, int $c = null) { //xdebug_debug_zval('a', 'b', 'c'); error_log(json_encode([$a, $b, $c])); error_log(json_encode(func_get_args())); } function add1($x) { return ++$x; } function changeF($code, $str) { error_log("in changeF"); //error_log($str); preg_match('/^Argument (\\d+) /', $str, $m); $i = $m[1]-1; $a = "$i"; $bt = debug_backtrace(null, 2); $bt1 = $bt[1]['args']; //xdebug_debug_zval("bt1"); //print_r($bt); $a = "$a {$bt[1]['args'][$i]}"; $bt[1]['args'][$i] = add1($bt[1]['args'][$i]); $bt1 = $bt[1]['args']; //xdebug_debug_zval("bt1"); $a = "$a {$bt[1]['args'][$i]}"; if (false && $i == 1) { $a = "$a ({$bt[1]['args'][1+$i]}"; ++$bt[1]['args'][1+$i]; $a = "$a {$bt[1]['args'][1+$i]})"; } error_log($a); //$zval = $bt[1]['args'][1]; //$bt[1]['args'][1] = add1($bt[1]['args'][1]); //print_r($bt); return true; } set_error_handler('changeF', E_ALL); //f(2, 1); g(3, 2, 1);
Output for git.master, git.master_jit, rfc.property-hooks
[3,2,1] [3,2,1]

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:
57.47 ms | 401 KiB | 8 Q