3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_to_address($context) { $array = explode(" ", $context); $array_reversed = array_reverse($array); $numKey = ""; $zipKey = ""; foreach($array_reversed as $k=>$str) { if($zipKey) { continue; } if(strlen($str)===5 && is_numeric($str)) { $zipKey = $k; } } $array_reversed = array_slice($array_reversed, $zipKey); $array = array_reverse($array_reversed); foreach($array as $k=>$str) { if($numKey) { continue; } if(strlen($str)>1 && strlen($str)<6 && is_numeric($str)) { $numKey = $k; } } $array = array_slice($array, $numKey); $string = implode(' ', $array); return $string; } echo str_to_address("Sally sells seashells at 452 Parks Way, Lemons, GA and loves it."); ?>

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)
8.3.60.0030.01618.27
8.3.50.0090.00822.12
8.3.40.0110.00418.83
8.3.30.0120.00319.14
8.3.20.0040.00420.24
8.3.10.0040.00423.70
8.3.00.0050.00322.34
8.2.180.0160.00316.75
8.2.170.0060.01222.96
8.2.160.0000.01422.08
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00722.13
8.2.110.0100.00019.24
8.2.100.0040.00818.02
8.2.90.0060.00319.17
8.2.80.0030.00617.97
8.2.70.0030.00617.50
8.2.60.0000.00818.03
8.2.50.0040.00418.10
8.2.40.0090.00019.31
8.2.30.0050.00318.08
8.2.20.0070.00017.83
8.2.10.0040.00419.59
8.2.00.0040.00417.66
8.1.280.0110.00425.92
8.1.270.0060.00322.01
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0060.00324.02
8.1.230.0110.00017.76
8.1.220.0050.00317.78
8.1.210.0080.00018.77
8.1.200.0060.00317.25
8.1.190.0080.00017.35
8.1.180.0040.00418.10
8.1.170.0080.00018.70
8.1.160.0050.00321.93
8.1.150.0000.00718.64
8.1.140.0000.00717.50
8.1.130.0030.00317.75
8.1.120.0050.00217.54
8.1.110.0030.00517.34
8.1.100.0040.00417.35
8.1.90.0000.00717.50
8.1.80.0030.00317.46
8.1.70.0030.00317.46
8.1.60.0040.00417.60
8.1.50.0030.00617.49
8.1.40.0030.00617.54
8.1.30.0000.00817.51
8.1.20.0070.00017.70
8.1.10.0040.00417.64
8.1.00.0000.00717.53
8.0.300.0040.00418.77
8.0.290.0050.00316.75
8.0.280.0030.00318.50
8.0.270.0050.00317.18
8.0.260.0030.00316.88
8.0.250.0070.00017.02
8.0.240.0030.00616.93
8.0.230.0000.00717.08
8.0.220.0000.00716.85
8.0.210.0030.00516.88
8.0.200.0080.00016.89
8.0.190.0050.00316.99
8.0.180.0040.00417.02
8.0.170.0030.00516.88
8.0.160.0000.00816.91
8.0.150.0000.00016.88
8.0.140.0030.00416.88
8.0.130.0030.00313.39
8.0.120.0040.00416.85
8.0.110.0040.00417.02
8.0.100.0000.00717.08
8.0.90.0000.00716.92
8.0.80.0080.00816.92
8.0.70.0040.00417.01
8.0.60.0080.00016.98
8.0.50.0030.00617.01
8.0.30.0080.01117.09
8.0.20.0090.00917.40
8.0.10.0030.00717.04
8.0.00.0100.00816.78
7.4.330.0000.00515.03
7.4.320.0000.00716.45
7.4.300.0030.00316.52
7.4.290.0000.00716.53
7.4.280.0000.00716.54
7.4.270.0000.00716.53
7.4.260.0000.00716.46
7.4.250.0000.00716.47
7.4.240.0040.00416.52
7.4.230.0070.00016.42
7.4.220.0060.01516.63
7.4.210.0090.00716.54
7.4.200.0030.00316.46
7.4.190.0000.00716.38
7.4.160.0080.00816.58
7.4.150.0220.00417.40
7.4.140.0060.01117.86
7.4.130.0140.00516.49
7.4.120.0160.00316.62
7.4.110.0070.01116.49
7.4.100.0130.00416.60
7.4.90.0000.01816.65
7.4.80.0060.01716.61
7.4.70.0130.00316.58
7.4.60.0150.00016.54
7.4.50.0060.00316.41
7.4.40.0090.00922.77
7.4.30.0120.00416.55
7.4.00.0030.01015.16
7.3.330.0000.00513.39
7.3.320.0020.00213.43
7.3.310.0000.00816.47
7.3.300.0000.00616.29
7.3.290.0070.00716.51
7.3.280.0060.00916.40
7.3.270.0140.00317.40
7.3.260.0060.01116.69
7.3.250.0040.01316.48
7.3.240.0100.00716.53
7.3.230.0090.00916.39
7.3.210.0110.00616.40
7.3.200.0140.00719.39
7.3.190.0060.01716.39
7.3.180.0060.01116.48
7.3.170.0130.00316.64
7.3.160.0070.01316.48
7.3.120.0080.00814.87
7.2.330.0090.00916.35
7.2.320.0100.01016.68
7.2.310.0030.01416.73
7.2.300.0170.00316.68
7.2.290.0070.01316.70
7.2.80.0110.00416.75
7.2.60.0000.01216.71
7.1.200.0030.00715.82
7.1.70.0000.00717.22
7.1.60.0070.01819.29
7.1.50.0030.02116.67
7.1.00.0070.07322.30
7.0.200.0040.00416.71
7.0.140.0030.07322.09
7.0.60.0030.06019.92
7.0.50.0030.08017.89
7.0.40.0030.09320.23
7.0.30.0670.04320.07
7.0.20.0230.07020.06
7.0.10.0070.08720.09
7.0.00.0100.06020.18
5.6.280.0100.06320.90
5.6.210.0070.07720.71
5.6.200.0070.06718.16
5.6.190.0030.05020.61
5.6.180.0270.05320.62
5.6.170.0130.08320.60
5.6.160.0070.08020.50
5.6.150.0070.08018.23
5.6.140.0100.08018.12
5.6.130.0130.07318.29
5.6.120.0100.05721.10
5.6.110.0170.07021.14
5.6.100.0070.07321.09
5.6.90.0230.06721.09
5.6.80.0030.04320.30
5.6.70.4300.03720.54
5.5.350.0170.06720.33
5.5.340.0030.06717.98
5.5.330.0000.06720.19
5.5.320.0270.06720.35
5.5.310.0270.07020.24
5.5.300.0100.08017.98
5.5.290.0070.08017.95
5.5.280.0030.04720.80
5.5.270.0030.09020.90
5.5.260.0100.07720.76
5.5.250.0100.06720.79
5.5.240.0030.07020.05
5.4.450.0230.07019.59
5.4.440.0300.06319.39
5.4.430.0230.05019.61
5.4.420.0230.06019.54
5.4.410.0130.05318.69
5.4.400.0130.05318.79
5.4.390.0200.04318.81
5.4.380.0230.04718.71
5.4.370.0270.06318.59
5.4.360.0230.04318.79
5.4.350.0170.06318.50
5.4.340.0230.05018.76
5.4.320.0040.04012.51
5.4.310.0050.04512.50
5.4.300.0080.04012.51
5.4.290.0090.03812.51
5.4.280.0070.05612.38
5.4.270.0070.05512.38
5.4.260.0100.05412.38
5.4.250.0070.05512.38
5.4.240.0110.05312.38
5.4.230.0130.05212.37
5.4.220.0100.05412.37
5.4.210.0100.05212.37
5.4.200.0060.06012.37
5.4.190.0110.05812.37
5.4.180.0110.06212.37
5.4.170.0090.06612.38
5.4.160.0110.05212.37
5.4.150.0130.05812.37
5.4.140.0100.06212.05
5.4.130.0080.06112.04
5.4.120.0060.06212.00
5.4.110.0060.06511.99
5.4.100.0080.05712.00
5.4.90.0080.06111.99
5.4.80.0110.05712.00
5.4.70.0120.05311.99
5.4.60.0080.05611.99
5.4.50.0060.06311.99
5.4.40.0090.05411.98
5.4.30.0090.05511.98
5.4.20.0130.05311.97
5.4.10.0120.05511.97
5.4.00.0090.05511.46
5.3.290.0070.04712.80
5.3.280.0140.06612.71
5.3.270.0100.05712.73
5.3.260.0100.05812.72
5.3.250.0100.05612.72
5.3.240.0140.05212.72
5.3.230.0110.05312.71
5.3.220.0110.05412.68
5.3.210.0100.05712.68
5.3.200.0110.05412.68
5.3.190.0100.05412.68
5.3.180.0070.05812.68
5.3.170.0100.05512.67
5.3.160.0140.05112.68
5.3.150.0100.05712.68
5.3.140.0140.05212.66
5.3.130.0130.05512.66
5.3.120.0100.05812.66
5.3.110.0070.06012.66
5.3.100.0100.05112.12
5.3.90.0120.05312.09
5.3.80.0100.05212.07
5.3.70.0100.05212.08
5.3.60.0070.05512.06
5.3.50.0080.05312.01
5.3.40.0070.05512.01
5.3.30.0080.05511.96
5.3.20.0090.05111.75
5.3.10.0120.04711.71
5.3.00.0100.05811.70
5.2.170.0090.0489.20
5.2.160.0060.0489.20
5.2.150.0090.0439.20
5.2.140.0060.0479.20
5.2.130.0060.0459.16
5.2.120.0070.0639.16
5.2.110.0040.0439.16
5.2.100.0090.0399.16
5.2.90.0090.0429.16
5.2.80.0140.0389.16
5.2.70.0080.0449.15
5.2.60.0070.0449.11
5.2.50.0090.0409.08
5.2.40.0060.0409.05
5.2.30.0080.0419.04
5.2.20.0090.0409.02
5.2.10.0100.0388.93
5.2.00.0150.0578.80
5.1.60.0060.0438.08
5.1.50.0120.0378.08
5.1.40.0100.0388.07
5.1.30.0090.0428.41
5.1.20.0090.0448.43
5.1.10.0150.0378.16
5.1.00.0130.0408.16
5.0.50.0100.0336.64
5.0.40.0080.0356.50
5.0.30.0100.0506.31
5.0.20.0130.0316.28
5.0.10.0110.0666.26
5.0.00.0110.0766.25
4.4.90.0100.0414.77
4.4.80.0080.0274.75
4.4.70.0080.0234.75
4.4.60.0020.0464.75
4.4.50.0050.0274.77
4.4.40.0060.0404.71
4.4.30.0030.0324.76
4.4.20.0050.0274.85
4.4.10.0060.0264.85
4.4.00.0060.0374.75
4.3.110.0040.0284.67
4.3.100.0030.0294.67
4.3.90.0080.0224.63
4.3.80.0080.0364.59
4.3.70.0060.0254.63
4.3.60.0060.0254.63
4.3.50.0060.0254.62
4.3.40.0090.0354.54
4.3.30.0040.0233.31
4.3.20.0030.0263.29
4.3.10.0020.0253.25
4.3.00.0270.02713.64

preferences:
44.6 ms | 401 KiB | 5 Q