3v4l.org

run code in 300+ PHP versions simultaneously
<? /** * Given a Hex IP Address, this script will convert * and display Decimal and Binary representations of * the IP Address. * * This script was created for a one time personal use. * It works for well for valid hex addresses, but may return * unexpected results for invalid hex input (non hex characters, * too many/few hex digits, etc). * * @author Josh Grochowski (josh@kastang.com) * */ //determines if the input is through a command line, or web browser if(isset($argv[1])) { $HEX_IP = $argv[1]; } else if(isset($_GET["hexip"])) { $HEX_IP = $_GET["hexip"]; } else { throw new Exception("No HEX Input through CLI or GET."); } $HEX_IP = str_split($HEX_IP, 2); $BIN_IP = ''; foreach($HEX_IP as $h) { $d = base_convert($h, 16, 2); //Pads the Binary string with 0's if length is less then 8. if(strlen($d) < 8) { $len = strlen($d); while($len < 8) { $d = '0'.$d; $len++; } } $BIN_IP .= $d; } //Displays the length of the Binary string and shows the IP in Binary Notation echo 'Binary Length: '. strlen($BIN_IP)."\n"; echo $BIN_IP."\n\n"; //Splits the string into 4, 8 bit segments. $BIN_IP = str_split($BIN_IP, 8); //Converts each Binary block to a decimal and forms the IP address. echo 'Decimal IP: '; $ip = ''; foreach($BIN_IP as $x) { $ip .= base_convert($x, 2, 10).'.'; } //Displays the IP Address in Decimal format. echo substr($ip, 0, -1)."\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)
8.3.70.0130.01016.58
8.3.60.0140.00316.48
8.3.50.0060.01222.03
8.3.40.0070.00718.59
8.3.30.0100.00319.00
8.3.20.0070.00020.38
8.3.10.0080.00021.94
8.3.00.0050.00318.04
8.2.180.0190.00318.01
8.2.170.0100.00722.96
8.2.160.0030.01020.38
8.2.150.0050.00224.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00421.03
8.2.110.0000.00822.10
8.2.100.0030.01017.66
8.2.90.0040.00419.18
8.2.80.0040.00417.97
8.2.70.0030.00617.25
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0040.00418.22
8.2.30.0030.00618.11
8.2.20.0050.00317.48
8.2.10.0000.00817.90
8.2.00.0000.00717.48
8.1.280.0140.00325.92
8.1.270.0000.00823.86
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00723.87
8.1.230.0060.00618.97
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00617.10
8.1.190.0040.00417.10
8.1.180.0040.00418.10
8.1.170.0080.00018.56
8.1.160.0050.00321.95
8.1.150.0030.00618.65
8.1.140.0070.00017.31
8.1.130.0040.00417.63
8.1.120.0050.00217.25
8.1.110.0000.00817.22
8.1.100.0000.00717.24
8.1.90.0000.00717.36
8.1.80.0000.00717.23
8.1.70.0040.00417.28
8.1.60.0050.00317.42
8.1.50.0080.00017.41
8.1.40.0000.00817.26
8.1.30.0080.00017.49
8.1.20.0030.00617.58
8.1.10.0000.00717.31
8.1.00.0070.00017.41
8.0.300.0000.00718.77
8.0.290.0040.00416.75
8.0.280.0080.00018.37
8.0.270.0070.00017.13
8.0.260.0030.00317.18
8.0.250.0000.00716.83
8.0.240.0040.00416.80
8.0.230.0030.00316.73
8.0.220.0070.00016.83
8.0.210.0000.00716.77
8.0.200.0030.00316.71
8.0.190.0000.00716.86
8.0.180.0000.00716.77
8.0.170.0040.00416.67
8.0.160.0040.00416.80
8.0.150.0070.00016.58
8.0.140.0070.00416.71
8.0.130.0000.00613.39
8.0.120.0000.00716.63
8.0.110.0000.00816.71
8.0.100.0040.00416.54
8.0.90.0000.00716.75
8.0.80.0030.01716.78
8.0.70.0000.00716.66
8.0.60.0040.00416.63
8.0.50.0060.00316.55
8.0.30.0160.00317.05
8.0.20.0100.00817.40
8.0.10.0040.00416.65
8.0.00.0070.01416.56
7.4.330.0030.00315.09
7.4.320.0030.00316.47
7.4.300.0030.00316.38
7.4.290.0000.00716.53
7.4.280.0000.00716.36
7.4.270.0080.00016.49
7.4.260.0000.00716.45
7.4.250.0050.00216.44
7.4.240.0020.00516.39
7.4.230.0030.00316.58
7.4.220.0090.00916.49
7.4.210.0030.01716.39
7.4.200.0030.00316.45
7.4.160.0110.00516.13
7.4.150.0040.01317.40
7.4.140.0050.01217.86
7.4.130.0160.00516.41
7.4.120.0100.00716.46
7.4.110.0030.01416.50
7.4.100.0120.00316.19
7.4.90.0100.00716.37
7.4.80.0120.01219.39
7.4.70.0080.00816.26
7.4.60.0100.00716.52
7.4.50.0060.00316.44
7.4.40.0130.00316.24
7.4.30.0090.00616.56
7.4.00.0100.00614.76
7.3.330.0030.00313.29
7.3.320.0060.00013.20
7.3.310.0000.00716.06
7.3.300.0070.00016.24
7.3.290.0060.01316.18
7.3.280.0090.00816.10
7.3.270.0170.00017.40
7.3.260.0160.00416.24
7.3.250.0080.01516.22
7.3.240.0140.00416.36
7.3.230.0070.01616.39
7.3.210.0070.01016.20
7.3.200.0110.00419.39
7.3.190.0090.01316.43
7.3.180.0040.01216.41
7.3.170.0100.00616.30
7.3.160.0040.01216.32
7.3.120.0090.00714.65
7.3.110.0030.01014.62
7.3.100.0140.00014.75
7.3.90.0140.00314.54
7.3.80.0110.00414.67
7.3.70.0030.00714.41
7.3.60.0120.00314.55
7.3.50.0060.00914.83
7.3.40.0090.00914.86
7.3.30.0030.01314.39
7.3.20.0070.01116.71
7.3.10.0110.00616.53
7.3.00.0080.00716.36
7.2.330.0080.00816.42
7.2.320.0100.00616.37
7.2.310.0110.01116.26
7.2.300.0100.00716.27
7.2.290.0090.00616.51
7.2.250.0040.01114.70
7.2.240.0070.01114.91
7.2.230.0060.01014.89
7.2.220.0030.01315.10
7.2.210.0110.00714.51
7.2.200.0040.01215.02
7.2.190.0080.00414.82
7.2.180.0030.00714.49
7.2.170.0090.00314.98
7.2.130.0050.01016.63
7.2.120.0100.00516.59
7.2.110.0080.00816.75
7.2.100.0110.00516.68
7.2.90.0120.00516.63
7.2.80.0120.00716.58
7.2.70.0100.00516.77
7.2.60.0110.00616.64
7.2.50.0080.00616.75
7.2.40.0090.00516.81
7.2.30.0050.00716.58
7.2.20.0090.00916.97
7.2.10.0050.00916.71
7.2.00.0080.00917.74
7.1.330.0060.01115.74
7.1.320.0070.00715.49
7.1.310.0120.00315.99
7.1.300.0030.00915.65
7.1.290.0140.00315.79
7.1.280.0090.00915.64
7.1.270.0140.00015.34
7.1.260.0060.01215.43
7.1.250.0060.01015.54
7.1.240.0140.00315.22
7.1.230.0030.00915.53
7.1.220.0140.00415.48
7.1.210.0090.00415.77
7.1.200.0050.00815.52
7.1.190.0120.00015.64
7.1.180.0100.00615.37
7.1.170.0030.00915.59
7.1.160.0070.00715.79
7.1.150.0110.00315.77
7.1.140.0170.00015.71
7.1.130.0110.00615.64
7.1.120.0160.00315.65
7.1.110.0130.00615.53
7.1.100.0040.01215.81
7.1.90.0120.00615.17
7.1.80.0120.00315.11
7.1.70.0090.00516.38
7.1.60.0070.01317.44
7.1.50.0080.01316.29
7.1.40.0070.01115.38
7.1.30.0040.01115.63
7.1.20.0030.00915.70
7.1.10.0160.00015.42
7.1.00.0040.04518.92
7.0.330.0040.01115.49
7.0.320.0000.01414.82
7.0.310.0070.01015.17
7.0.300.0110.00714.93
7.0.290.0110.00315.36
7.0.280.0090.00315.20
7.0.270.0100.00715.24
7.0.260.0070.01114.98
7.0.250.0130.00315.12
7.0.240.0100.00715.13
7.0.230.0090.00915.10
7.0.220.0090.00915.17
7.0.210.0090.00615.37
7.0.200.0150.00516.01
7.0.190.0070.01015.34
7.0.180.0130.00315.18
7.0.170.0070.01015.11
7.0.160.0080.00815.13
7.0.150.0120.00615.26
7.0.140.0070.03918.62
7.0.130.0140.00315.23
7.0.120.0070.01115.09
7.0.110.0120.00414.98
7.0.100.0120.00614.84
7.0.90.0140.00315.42
7.0.80.0100.00715.25
7.0.70.0100.00715.05
7.0.60.0110.04317.44
7.0.50.0110.04216.56
7.0.40.0070.03216.75
7.0.30.0170.03716.73
7.0.20.0110.02816.84
7.0.10.0050.03116.80
7.0.00.0050.05116.66
5.6.380.0070.00714.17
5.6.370.0040.01214.19
5.6.360.0080.00614.63
5.6.350.0090.00014.34
5.6.340.0060.01214.42
5.6.330.0100.00714.06
5.6.320.0110.01114.28
5.6.310.0140.00513.77
5.6.300.0090.00914.07
5.6.290.0090.00913.98
5.6.280.0050.04517.60
5.6.270.0060.01214.24
5.6.260.0070.01213.98
5.6.250.0090.00914.08
5.6.240.0100.01014.04
5.6.230.0080.00814.43
5.6.220.0080.01714.23
5.6.210.0130.04517.28
5.6.200.0120.02216.24
5.6.190.0150.03217.41
5.6.180.0190.02917.39
5.6.170.0160.04517.34
5.6.160.0080.02517.38
5.6.150.0100.04716.13
5.6.140.0150.01816.39
5.6.130.0070.03816.17
5.6.120.0110.03517.68
5.6.110.0080.04017.55
5.6.100.0040.02917.62
5.6.90.0080.04117.76
5.6.80.0020.03317.24
5.6.70.0060.00614.09
5.6.60.0030.00913.94
5.6.50.0130.00313.91
5.6.40.0110.00313.99
5.6.30.0090.00614.34
5.6.20.0070.00714.31
5.6.10.0030.00714.20
5.6.00.0000.01114.22
5.5.380.0100.00511.38
5.5.370.0100.00311.26
5.5.360.0130.00311.40
5.5.350.0160.04415.96
5.5.340.0090.04514.55
5.5.330.0090.03915.68
5.5.320.0150.04415.79
5.5.310.0220.04415.68
5.5.300.0110.04014.66
5.5.290.0110.04114.34
5.5.280.0080.04616.19
5.5.270.0070.04615.92
5.5.260.0050.04315.76
5.5.250.0100.03915.81
5.5.240.0030.04315.53
5.5.230.0070.00711.02
5.5.220.0150.00310.98
5.5.210.0060.00910.73
5.5.200.0090.00610.91
5.5.190.0080.00810.99
5.5.180.0070.00710.91
5.5.170.0030.00610.90
5.5.160.0030.00710.63
5.5.150.0050.00510.49
5.5.140.0000.01210.40
5.5.130.0080.00410.83
5.5.120.0080.00811.28
5.5.110.0060.00610.98
5.5.100.0040.01110.91
5.5.90.0080.00811.30
5.5.80.0000.00810.75
5.5.70.0100.00310.95
5.5.60.0000.01111.10
5.5.50.0000.00910.89
5.5.40.0040.00711.17
5.5.30.0040.00711.00
5.5.20.0090.00311.14
5.5.10.0000.00610.73
5.5.00.0070.00310.68
5.4.450.0330.02715.22
5.4.440.0400.03314.85
5.4.430.0420.03014.88
5.4.420.0310.03315.06
5.4.410.0070.03314.77
5.4.400.0120.03514.72
5.4.390.0180.03114.85
5.4.380.0210.02614.71
5.4.370.0070.03414.87
5.4.360.0060.02214.93
5.4.350.0080.02611.47
5.4.340.0080.02011.44
5.4.330.0110.00311.03
5.4.320.0080.02111.74
5.4.310.0080.02011.67
5.4.300.0090.02111.60
5.4.290.0060.02311.70
5.4.280.0060.02211.66
5.4.270.0060.02811.71
5.4.260.0100.02411.67
5.4.250.0060.02311.53
5.4.240.0050.02111.56
5.4.230.0050.02211.62
5.4.220.0070.02111.60
5.4.210.0050.02711.57
5.4.200.0050.02511.59
5.4.190.0050.02811.32
5.4.180.0060.02311.45
5.4.170.0090.02211.52
5.4.160.0050.02111.45
5.4.150.0070.01911.51
5.4.140.0040.02411.42
5.4.130.0060.02011.40
5.4.120.0050.02111.31
5.4.110.0040.02311.38
5.4.100.0050.02011.23
5.4.90.0040.02311.40
5.4.80.0030.02311.30
5.4.70.0080.02011.21
5.4.60.0030.03111.41
5.4.50.0070.02011.16
5.4.40.0070.01911.37
5.4.30.0080.02011.29
5.4.20.0040.02411.38
5.4.10.0050.02111.34
5.4.00.0040.02511.21
5.3.290.0100.02211.61
5.3.280.0040.02611.45
5.3.270.0020.03111.51
5.3.260.0040.02811.39
5.3.250.0070.02311.50
5.3.240.0050.02311.47
5.3.230.0050.02211.53
5.3.220.0080.01811.32
5.3.210.0090.01911.34
5.3.200.0090.01911.36
5.3.190.0050.02411.41
5.3.180.0080.02511.48
5.3.170.0050.02311.43
5.3.160.0050.02111.48
5.3.150.0040.02311.48
5.3.140.0040.02511.36
5.3.130.0060.02111.38
5.3.120.0050.02111.42
5.3.110.0020.02511.44
5.3.100.0060.02011.13
5.3.90.0050.02111.17
5.3.80.0040.02111.13
5.3.70.0040.02311.01
5.3.60.0080.02211.14
5.3.50.0060.01911.04
5.3.40.0040.02111.04
5.3.30.0060.02011.00
5.3.20.0040.02110.91
5.3.10.0020.02010.79
5.3.00.0050.02010.72
5.2.170.0050.0209.30
5.2.160.0050.0169.29
5.2.150.0040.0179.29
5.2.140.0030.0199.29
5.2.130.0050.0199.28
5.2.120.0060.0159.28
5.2.110.0030.0179.28
5.2.100.0050.0159.28
5.2.90.0040.0249.28
5.2.80.0040.0179.27
5.2.70.0080.0149.27
5.2.60.0060.0159.25
5.2.50.0020.0209.24
5.2.40.0040.0189.23
5.2.30.0050.0179.21
5.2.20.0050.0169.20
5.2.10.0050.0199.17
5.2.00.0040.0239.10
5.1.60.0020.0178.74
5.1.50.0040.0158.74
5.1.40.0020.0148.72
5.1.30.0030.0178.90
5.1.20.0040.0178.91
5.1.10.0030.0168.78
5.1.00.0030.0168.78
5.0.50.0060.0098.01
5.0.40.0040.0147.95
5.0.30.0060.0187.85
5.0.20.0040.0127.84
5.0.10.0060.0107.83
5.0.00.0020.0187.82
4.4.90.0050.0077.10
4.4.80.0020.0087.09
4.4.70.0020.0097.08
4.4.60.0030.0077.08
4.4.50.0040.0087.09
4.4.40.0010.0167.06
4.4.30.0050.0097.09
4.4.20.0020.0127.13
4.4.10.0040.0077.13
4.4.00.0060.0127.09
4.3.110.0020.0107.04
4.3.100.0040.0107.04
4.3.90.0040.0117.03
4.3.80.0050.0167.00
4.3.70.0040.0087.02
4.3.60.0060.0077.02
4.3.50.0060.0107.02
4.3.40.0040.0146.97
4.3.30.0020.0116.35
4.3.20.0030.0126.33
4.3.10.0040.0096.31
4.3.00.0030.0128.27

preferences:
46.51 ms | 401 KiB | 5 Q