3v4l.org

run code in 300+ PHP versions simultaneously
<?php $address = '2001:db8::567:89ab'; $parts = explode(':', $address); $len = count($parts); if ($len < 8) { if ($parts[0] === '') { array_splice($parts, 0, 0, array_fill(0, 8 - $len, 0)); $parts = array_reverse($parts); } else { $parts = array_reverse($parts); if ($parts[0] === '') { array_splice($parts, 0, 0, array_fill(0, 8 - $len, 0)); } else { array_splice($parts, array_search('', $parts), 0, array_fill(0, 8 - $len, 0)); } } } $nibbles = []; $hex = '0123456789abcdef'; foreach (array_map('hexdec', $parts) as $part) { array_push( $nibbles, $hex[$part & 0x000F], $hex[($part & 0x00F0) >> 4], $hex[($part & 0x0F00) >> 8], $hex[($part & 0xF000) >> 12] ); } echo implode('.', $nibbles);

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.0140.00018.56
8.3.50.0100.01221.14
8.3.40.0140.00718.79
8.3.30.0110.00320.29
8.3.20.0000.00820.58
8.3.10.0080.00021.04
8.3.00.0000.00822.39
8.2.180.0040.01116.50
8.2.170.0120.00322.96
8.2.160.0030.01020.35
8.2.150.0080.00024.18
8.2.140.0030.00724.66
8.2.130.0040.00426.16
8.2.120.0040.00421.19
8.2.110.0050.00519.21
8.2.100.0090.00317.82
8.2.90.0040.00419.35
8.2.80.0040.00417.97
8.2.70.0080.00017.75
8.2.60.0060.00318.16
8.2.50.0000.00818.07
8.2.40.0000.00817.91
8.2.30.0060.00319.34
8.2.20.0000.00817.75
8.2.10.0030.00617.77
8.2.00.0040.00417.77
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0020.00526.35
8.1.250.0000.00728.09
8.1.240.0040.00423.88
8.1.230.0040.00720.91
8.1.220.0040.00418.77
8.1.210.0000.01019.01
8.1.200.0090.00317.48
8.1.190.0000.00817.53
8.1.180.0050.00318.10
8.1.170.0040.00418.70
8.1.160.0060.00318.92
8.1.150.0030.00618.57
8.1.140.0040.00417.39
8.1.130.0050.00217.84
8.1.120.0000.00817.43
8.1.110.0000.00817.46
8.1.100.0050.00217.46
8.1.90.0040.00417.38
8.1.80.0040.00417.38
8.1.70.0070.00017.45
8.1.60.0020.00517.57
8.1.50.0030.00617.44
8.1.40.0040.00417.56
8.1.30.0050.00317.54
8.1.20.0000.00817.63
8.1.10.0040.00417.61
8.1.00.0090.00017.54
8.0.300.0060.00319.64
8.0.290.0030.00517.18
8.0.280.0030.00318.42
8.0.270.0000.00717.33
8.0.260.0040.00416.89
8.0.250.0000.00716.86
8.0.240.0000.00816.98
8.0.230.0030.00317.02
8.0.220.0070.00016.92
8.0.210.0000.00816.93
8.0.200.0030.00316.86
8.0.190.0040.00416.91
8.0.180.0000.00716.92
8.0.170.0030.00316.86
8.0.160.0000.00716.92
8.0.150.0000.00716.77
8.0.140.0040.00416.83
8.0.130.0000.00813.43
8.0.120.0000.00816.88
8.0.110.0000.00716.96
8.0.100.0020.00516.71
8.0.90.0000.00717.00
8.0.80.0080.00616.82
8.0.70.0000.00716.77
8.0.60.0040.00416.79
8.0.50.0000.00816.77
8.0.30.0130.01017.31
8.0.20.0100.00917.40
8.0.10.0040.00416.86
8.0.00.0050.01216.74
7.4.330.0020.00216.79
7.4.320.0070.00016.52
7.4.300.0040.00416.63
7.4.290.0040.00416.46
7.4.280.0030.00316.57
7.4.270.0030.00316.62
7.4.260.0030.00313.30
7.4.250.0000.00816.61
7.4.240.0050.00216.60
7.4.230.0000.00716.63
7.4.220.0110.00716.51
7.4.210.0060.00816.61
7.4.200.0080.00016.70
7.4.190.0030.00316.56
7.4.160.0160.00616.52
7.4.150.0130.01017.40
7.4.140.0100.00717.86
7.4.130.0100.00916.49
7.4.120.0090.00916.61
7.4.110.0030.01416.59
7.4.100.0090.00916.51
7.4.90.0140.00716.47
7.4.80.0150.00319.39
7.4.70.0100.00716.54
7.4.60.0030.01616.59
7.4.50.0090.00016.47
7.4.40.0090.00622.77
7.4.30.0100.00716.44
7.4.00.0070.01014.78
7.3.330.0030.00313.21
7.3.320.0000.00513.27
7.3.310.0030.00316.23
7.3.300.0030.00316.39
7.3.290.0080.01216.31
7.3.280.0090.00816.31
7.3.270.0100.00717.40
7.3.260.0150.00518.24
7.3.250.0160.01616.47
7.3.240.0130.00416.49
7.3.230.0130.00616.39
7.3.210.0090.00916.39
7.3.200.0050.01719.39
7.3.190.0110.01216.31
7.3.180.0120.00916.57
7.3.170.0000.01516.49
7.3.160.0030.01316.42
7.3.120.0070.00714.85
7.3.10.0040.00816.78
7.3.00.0040.01116.75
7.2.330.0060.01316.86
7.2.320.0130.00316.71
7.2.310.0030.01316.50
7.2.300.0060.01216.53
7.2.290.0110.00616.68
7.2.130.0000.01316.80
7.2.120.0030.01017.03
7.2.110.0030.01017.07
7.2.100.0000.01316.83
7.2.90.0060.00616.98
7.2.80.0090.00916.79
7.2.70.0070.00416.77
7.2.60.0080.00416.94
7.2.50.0080.00417.01
7.2.40.0050.00516.92
7.2.30.0060.00616.81
7.2.20.0040.00717.08
7.2.10.0000.00917.05
7.2.00.0040.01118.11
7.1.250.0080.00016.07
7.1.100.0030.00918.32
7.1.70.0040.00417.19
7.1.60.0130.01019.17
7.1.50.0110.01117.05
7.1.00.0030.07722.31
7.0.200.0040.00416.73
7.0.140.0000.07722.07
7.0.60.0200.06719.87
7.0.50.0070.07317.66
7.0.40.0070.08720.25
7.0.30.0330.05020.00
7.0.20.0330.06320.09
7.0.10.0100.04020.17
7.0.00.0030.05020.16
5.6.280.0000.07721.07
5.6.210.0130.07020.61
5.6.200.0030.08718.13
5.6.190.0170.03020.41
5.6.180.0500.05720.39
5.6.170.0200.07020.56
5.6.160.0030.08320.71
5.6.150.0000.08718.18
5.6.140.0100.04018.11
5.6.130.0030.08318.15
5.6.120.0170.07720.98
5.6.110.0130.06321.01
5.6.100.0130.08021.14
5.6.90.0130.05721.13
5.6.80.0130.07320.29
5.5.350.4330.03720.39
5.5.340.0070.04017.98
5.5.330.0000.08320.36
5.5.320.0070.06720.51
5.5.310.0270.04020.41
5.5.300.0000.04317.98
5.5.290.0070.05317.98
5.5.280.0000.04720.77
5.5.270.0100.08320.88
5.5.260.0070.08020.68
5.5.250.0130.05720.58
5.5.240.0300.06320.13
5.4.450.0500.06719.49
5.4.440.0330.04319.40
5.4.430.3470.04719.57
5.4.420.0270.07019.41
5.4.410.0600.03019.33
5.4.400.0400.07019.09
5.4.390.0300.04019.09
5.4.380.0600.03019.16
5.4.370.0430.07018.88
5.4.360.0370.04019.09
5.4.350.0370.04019.06
5.4.340.0200.04319.06
5.4.320.0500.06719.22
5.4.310.0330.04019.09
5.4.300.0370.05018.80
5.4.290.0400.03718.82
5.4.280.0400.05318.93
5.4.270.0500.06319.24
5.4.260.0470.04319.17
5.4.250.0430.04718.87
5.4.240.0430.03719.07
5.4.230.0500.06319.13
5.4.220.0430.03318.91
5.4.210.0370.03718.89
5.4.200.0430.06319.21
5.4.190.0330.04019.24
5.4.180.0530.06018.90
5.4.170.0430.06319.07
5.4.160.0470.06318.89
5.4.150.0400.03719.14
5.4.140.0370.03716.22
5.4.130.0300.03716.28
5.4.120.0370.02716.30
5.4.110.0300.03716.40
5.4.100.0300.04016.39
5.4.90.0300.04016.48
5.4.80.0370.03716.25
5.4.70.0430.05716.21
5.4.60.0330.03716.20
5.4.50.0170.03316.37
5.4.40.0330.06316.36
5.4.30.0300.03716.21
5.4.20.0300.04016.36
5.4.10.0330.03316.45
5.4.00.0370.03015.89
5.3.290.0470.06314.50
5.3.280.0330.04014.63
5.3.270.0530.05714.55
5.3.260.0470.04314.56
5.3.250.0270.04014.57
5.3.240.0370.03314.45
5.3.230.0330.03714.70
5.3.220.0370.04014.41
5.3.210.0400.04014.41
5.3.200.0470.03314.43
5.3.190.0400.02714.55
5.3.180.0330.03314.41
5.3.170.0270.04014.41
5.3.160.0430.03714.66
5.3.150.0170.07314.49
5.3.140.0270.06014.59
5.3.130.0470.06014.39
5.3.120.0270.05014.38
5.3.110.0400.04014.39
5.3.100.0300.03714.07
5.3.90.0300.03713.86
5.3.80.0330.03714.11
5.3.70.0370.03014.05
5.3.60.0300.03713.84
5.3.50.0370.04013.74
5.3.40.0330.03313.79
5.3.30.0370.03013.89
5.3.20.0270.04013.74
5.3.10.0370.02713.46
5.3.00.0330.03713.44
5.2.170.0230.04011.00
5.2.160.0200.03311.24
5.2.150.0270.02710.99
5.2.140.0200.03311.24
5.2.130.0270.03310.94
5.2.120.0230.03010.96
5.2.110.0300.02711.26
5.2.100.0300.02311.04
5.2.90.0300.03011.12
5.2.80.0230.03011.11
5.2.70.0270.03011.19
5.2.60.0270.02710.96
5.2.50.0270.03311.07
5.2.40.0170.03010.85
5.2.30.0200.02711.01
5.2.20.0300.05010.82
5.2.10.0270.03710.90
5.2.00.0130.03310.59
5.1.60.0130.03010.01
5.1.50.0270.02010.07
5.1.40.0300.01310.14
5.1.30.0270.03010.38
5.1.20.0300.03010.40
5.1.10.0230.02710.00
5.1.00.0230.0239.98
5.0.50.0130.0378.49
5.0.40.0200.0308.39
5.0.30.0200.0578.32
5.0.20.0130.0378.36
5.0.10.0230.0378.13
5.0.00.0230.0278.15
4.4.90.0130.0176.96
4.4.80.0100.0176.96
4.4.70.0070.0206.96
4.4.60.0170.0306.96
4.4.50.0130.0276.96
4.4.40.0100.0236.96
4.4.30.0100.0176.96
4.4.20.0130.0336.96
4.4.10.0070.0236.96
4.4.00.0170.0436.96
4.3.110.0130.0206.96
4.3.100.0230.0276.96
4.3.90.0170.0306.96
4.3.80.0130.0306.96
4.3.70.0170.0336.96
4.3.60.0170.0276.96
4.3.50.0170.0276.96
4.3.40.0170.0506.96
4.3.30.0100.0336.96
4.3.20.0100.0206.96
4.3.10.0070.0206.96
4.3.00.0030.0236.96

preferences:
48.51 ms | 401 KiB | 5 Q