3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_1 = array( 'apple'=>1,'banana'=>2,'coconut'=> 3); $array_2 = array( 'apple'=>2,'banana'=>3,'coconut'=> 4); foreach( $array_1 as $fruit => $num) { if(array_key_exists($fruit, $array_2)){ //check if key from array_1 exists in array_2 $final_array[] = $fruit => $array_1[$fruit].','.$array_2[$fruit]; //concatenate values from shared key } } print_r ($final_array);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.300.0080.03612.50
5.4.290.0060.03912.50
5.4.280.0050.03912.39
5.4.270.0070.03812.39
5.4.260.0070.03612.39
5.4.250.0060.03612.39
5.4.240.0030.04512.39
5.4.230.0060.04112.39
5.4.220.0050.03612.39
5.4.210.0060.03412.39
5.4.200.0080.03512.38
5.4.190.0040.03812.38
5.4.180.0050.03612.38
5.4.170.0070.04212.39
5.4.160.0030.04412.39
5.4.150.0050.03612.38
5.4.140.0060.03712.07
5.4.130.0060.04412.05
5.4.120.0070.03412.02
5.4.110.0040.03612.01
5.4.100.0060.03412.02
5.4.90.0050.03712.02
5.4.80.0050.03712.02
5.4.70.0070.03912.01
5.4.60.0100.03112.01
5.4.50.0070.03412.02
5.4.40.0080.04112.00
5.4.30.0100.05511.99
5.4.20.0040.04211.99
5.4.10.0080.03112.00
5.4.00.0050.03611.49
5.3.280.0050.03812.71
5.3.270.0040.04112.72
5.3.260.0070.03812.72
5.3.250.0080.03512.72
5.3.240.0050.04412.72
5.3.230.0060.03712.71
5.3.220.0070.03512.68
5.3.210.0100.04312.68
5.3.200.0070.03512.68
5.3.190.0050.03812.68
5.3.180.0030.03812.67
5.3.170.0090.03312.67
5.3.160.0050.03612.68
5.3.150.0070.04312.67
5.3.140.0080.03812.66
5.3.130.0070.03712.66
5.3.120.0100.03812.66
5.3.110.0090.03512.66
5.3.100.0060.04012.12
5.3.90.0080.04412.08
5.3.80.0070.03512.07
5.3.70.0070.04312.07
5.3.60.0060.04112.06
5.3.50.0060.04012.00
5.3.40.0070.03412.00
5.3.30.0060.04011.95
5.3.20.0070.03911.73
5.3.10.0050.03511.70
5.3.00.0070.03411.68

preferences:
136.62 ms | 1394 KiB | 7 Q