3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mergeArray(array $arr1, array $arr2) { $keysStats = array(); foreach ($arr1 as $index => $key) { $keysStats[$key] = array( 'arr1' => $index, 'arr2' => null ); } foreach ($arr1 as $index => $key) { if (!is_array($keys[$key])) { $keysStats[$key] = array( 'arr1' => null ); } $keysStats[$key]['arr2'] = $index; } $merged = array(); foreach (sort($keysStats) as $key => $score) { if (is_null($keysStats['arr2'])) { $merged[] = null; } else { $merged[] = $arr2[$keysStats['arr2']]; } } return $arrMerged; } print_r(mergeArray( array( 'a', 'b', 'c', 'd', 'e', 'f', 'g' ), array( 'a', 'b', 'z', 'q' ) ));
Output for git.master, git.master_jit
Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on value of type null in /in/Ger3D on line 13 Warning: foreach() argument must be of type array|object, bool given in /in/Ger3D on line 23 Warning: Undefined variable $arrMerged in /in/Ger3D on line 31
Output for rfc.property-hooks
Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: Undefined variable $keys in /in/Ger3D on line 13 Warning: Trying to access array offset on null in /in/Ger3D on line 13 Warning: foreach() argument must be of type array|object, true given in /in/Ger3D on line 23 Warning: Undefined variable $arrMerged in /in/Ger3D on line 31

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:
51.21 ms | 403 KiB | 8 Q