3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class wtf { function array_merge_recursive_distinct() { $arrays = func_get_args(); $base = array_shift($arrays); foreach ($arrays as $array) { reset($base); //important while (list($key, $value) = @each($array)) { if (is_array($value) && @is_array($base[$key])) { $base[$key] = self::array_merge_recursive_distinct($base[$key], $value); } else { $base[$key] = $value; } } } return $base; } } $a = array( "exists" => 1, "doesnotexist" => 1, "arraytest" => array( "exists" => 1, "doesnotexist" => 1 ) ); $b = array( "exists" => 2, "arraytest" => array( "exists" => 2, ) ); $c = wtf::array_merge_recursive_distinct($a, $b); print_r($c);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Non-static method wtf::array_merge_recursive_distinct() cannot be called statically in /in/TWFdk:39 Stack trace: #0 {main} thrown in /in/TWFdk on line 39
Process exited with code 255.

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