3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php $testarr = array( 'advertiser' => array( 'id'=>345343, 'name'=>'Advertiser123', 'agency' => array( 'id'=>345343, 'name'=>'Agency456', 'organisation' => array( 'id'=>223334, 'name'=>'Organisation456' ) ) ) ); function getkeypath($arr, $lookup) { if (in_array($lookup, $arr)) { return array($lookup); } else { foreach ($arr as $key => $subarr) { if (is_array($subarr)) { $ret = getkeypath($subarr, $lookup); if ($ret) { $ret[] = $key; return $ret; } } } } return null; } echo '$testarr: ' . "\n"; print_r($testarr); echo "\n" . '7: ' . "\n" . print_r(getkeypath($testarr, 223334), true) . "\n";

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.380.0230.05318.75
5.4.370.0220.05518.62
5.4.360.0230.05518.75
5.4.350.0170.05818.63
5.4.340.0230.04818.67
5.4.320.0200.05718.65
5.4.310.0180.05718.71
5.4.300.0220.05318.62
5.4.290.0220.06318.79
5.4.280.0200.06318.79
5.4.270.0180.06018.66
5.4.260.0180.06518.55
5.4.250.0270.06518.61
5.4.240.0230.06518.54
5.4.230.0280.05518.73
5.4.220.0200.06818.64
5.4.210.0220.05018.79
5.4.200.0180.06016.69
5.4.190.0250.05018.45
5.4.180.0220.05518.77
5.4.170.0250.04818.64
5.4.160.0180.05718.69
5.4.150.0270.05718.55
5.4.140.0180.06016.37
5.4.130.0230.05016.22
5.4.120.0150.05316.38
5.4.110.0200.05816.34
5.4.100.0170.05816.32
5.4.90.0220.05816.43
5.4.80.0200.05216.27
5.4.70.0170.05316.35
5.4.60.0220.05216.33
5.4.50.0120.05516.33
5.4.40.0230.04716.19
5.4.30.0230.05016.13
5.4.20.0130.05516.28
5.4.10.0120.05716.19
5.4.00.0200.04815.66
5.3.290.0220.05714.61
5.3.280.0220.05814.57
5.3.270.0180.05214.61
5.3.260.0180.05514.53
5.3.250.0270.05014.65
5.3.240.0220.06014.60
5.3.230.0120.06714.61
5.3.220.0150.06514.48
5.3.210.0200.06214.52
5.3.200.0230.05714.48
5.3.190.0220.05814.56
5.3.180.0230.05714.52
5.3.170.0250.05514.49
5.3.160.0250.05714.54
5.3.150.0230.05514.52
5.3.140.0150.05714.54
5.3.130.0250.04714.48
5.3.120.0220.05214.56
5.3.110.0170.05814.54
5.3.100.0170.05314.02
5.3.90.0180.05014.10
5.3.80.0170.05313.92
5.3.70.0180.05714.04
5.3.60.0200.04813.93
5.3.50.0250.05013.88
5.3.40.0170.05513.95
5.3.30.0250.05013.94
5.3.20.0220.04713.63
5.3.10.0200.05513.62
5.3.00.0250.05313.65
5.2.170.0180.04511.09
5.2.160.0170.04211.14
5.2.150.0220.04311.12
5.2.140.0120.04811.16
5.2.130.0180.04011.05
5.2.120.0100.04311.08
5.2.110.0120.04511.11
5.2.100.0150.03811.13
5.2.90.0080.04511.06
5.2.80.0150.04711.10
5.2.70.0120.05011.17
5.2.60.0130.04511.14
5.2.50.0150.04211.01
5.2.40.0170.03710.98
5.2.30.0070.04710.93
5.2.20.0100.04310.94
5.2.10.0120.04010.94
5.2.00.0070.04510.76
5.1.60.0130.03210.08
5.1.50.0120.03710.03
5.1.40.0100.03710.02
5.1.30.0120.03810.34
5.1.20.0150.03810.37
5.1.10.0120.04210.09
5.1.00.0100.03710.08
5.0.50.0100.0278.61
5.0.40.0070.0288.43
5.0.30.0150.0358.25
5.0.20.0080.0288.33
5.0.10.0080.0288.32
5.0.00.0100.0428.17
4.4.90.0080.0236.44
4.4.80.0050.0236.42
4.4.70.0070.0206.45
4.4.60.0070.0236.40
4.4.50.0070.0236.42
4.4.40.0120.0386.44
4.4.30.0030.0276.44
4.4.20.0130.0186.43
4.4.10.0120.0226.48
4.4.00.0070.0356.46
4.3.110.0070.0256.38
4.3.100.0070.0206.41
4.3.90.0020.0286.44
4.3.80.0050.0406.39
4.3.70.0050.0306.38
4.3.60.0070.0236.38
4.3.50.0020.0256.41
4.3.40.0080.0356.41
4.3.30.0030.0225.77
4.3.20.0050.0225.76
4.3.10.0070.0205.74
4.3.00.0000.0236.99

preferences:
141.22 ms | 1394 KiB | 7 Q