3v4l.org

run code in 300+ PHP versions simultaneously
<?php $answer = 42; // The Setup settype($answer, 'integer'); $s = (string) $a = &$answer; $ns = (string) $n = (isset($s[1])) ? ($a >> 1)+$s[1] : ($a >> 1)+$s[0]; $f = ((int) $ns[0] ^ (int) $s[1]); // The Riddle function riddle($a, $n, $s, $f, $ns) { if ( ($a != 0 && luhn($a)) && (!$f) && (($n | $a) == 63) && (!isset($s[2])) ) { return TRUE; } return FALSE; } // The Result if (riddle($a, $n, $s, $f, $ns)) { echo "You got the correct answer! ($a)"; } else { echo "Sorry, wrong answer. ($a)"; } function luhn($number) { settype($number, 'string'); $sumTable = array( array(0,1,2,3,4,5,6,7,8,9), array(0,2,4,6,8,1,3,5,7,9)); $sum = 0; $flip = 0; for ($i = strlen($number) - 1; $i >= 0; $i--) { $sum += $sumTable[$flip++ & 0x1][$number[$i]]; } return $sum % 10 === 0; }

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.0120.00316.75
8.3.60.0070.01418.38
8.3.50.0110.00722.00
8.3.40.0120.00318.93
8.3.30.0110.00419.21
8.3.20.0040.00420.29
8.3.10.0030.00621.78
8.3.00.0040.00419.27
8.2.180.0100.01018.36
8.2.170.0090.00622.96
8.2.160.0090.00620.39
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0020.00526.16
8.2.120.0040.00420.98
8.2.110.0110.01119.33
8.2.100.0090.00318.03
8.2.90.0030.00519.30
8.2.80.0030.00517.97
8.2.70.0000.00817.60
8.2.60.0000.00918.05
8.2.50.0030.00618.07
8.2.40.0040.00420.01
8.2.30.0020.00518.31
8.2.20.0000.00817.85
8.2.10.0040.00418.04
8.2.00.0000.00917.90
8.1.280.0100.01025.92
8.1.270.0030.00623.92
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00522.19
8.1.230.0120.00019.08
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0000.01017.35
8.1.190.0000.00817.23
8.1.180.0060.00618.10
8.1.170.0060.00318.46
8.1.160.0040.00421.97
8.1.150.0030.00618.54
8.1.140.0040.00417.41
8.1.130.0080.00017.78
8.1.120.0080.00017.42
8.1.110.0050.00317.39
8.1.100.0040.00417.48
8.1.90.0070.00017.50
8.1.80.0040.00417.52
8.1.70.0000.00717.46
8.1.60.0000.00917.48
8.1.50.0040.00417.63
8.1.40.0000.00717.58
8.1.30.0030.00517.70
8.1.20.0040.00417.67
8.1.10.0020.00517.64
8.1.00.0000.00717.44
8.0.300.0000.00818.77
8.0.290.0050.00316.74
8.0.280.0040.00418.48
8.0.270.0000.00717.29
8.0.260.0030.00317.21
8.0.250.0060.00017.04
8.0.240.0050.00317.02
8.0.230.0040.00416.97
8.0.220.0030.00316.99
8.0.210.0040.00417.05
8.0.200.0040.00417.10
8.0.190.0050.00217.13
8.0.180.0000.00716.88
8.0.170.0080.00017.03
8.0.160.0000.00816.87
8.0.150.0040.00417.01
8.0.140.0050.00316.97
8.0.130.0050.00013.30
8.0.120.0040.00417.02
8.0.110.0040.00416.84
8.0.100.0040.00416.89
8.0.90.0040.00416.90
8.0.80.0090.00616.93
8.0.70.0000.00817.10
8.0.60.0000.00816.97
8.0.50.0030.00616.98
8.0.30.0150.00617.32
8.0.20.0060.01717.40
8.0.10.0030.00317.16
8.0.00.0140.01416.80
7.4.330.0050.00015.09
7.4.320.0030.00316.54
7.4.300.0030.00316.46
7.4.290.0000.00716.44
7.4.280.0000.00716.66
7.4.270.0050.00216.49
7.4.260.0000.00816.47
7.4.250.0000.00816.60
7.4.240.0040.00316.56
7.4.230.0030.00316.29
7.4.220.0100.00716.66
7.4.210.0050.01016.60
7.4.200.0070.00016.64
7.4.190.0040.00416.59
7.4.160.0100.00716.52
7.4.150.0040.01417.40
7.4.140.0110.01117.86
7.4.130.0120.00716.56
7.4.120.0120.00516.51
7.4.110.0060.01216.60
7.4.100.0130.01016.48
7.4.90.0130.01016.60
7.4.80.0080.00819.39
7.4.70.0060.01016.61
7.4.60.0100.00716.59
7.4.50.0000.00816.47
7.4.40.0090.00916.44
7.4.30.0090.00616.38
7.4.10.0090.00614.82
7.4.00.0070.00715.04
7.3.330.0000.00613.23
7.3.320.0000.00513.14
7.3.310.0030.00316.22
7.3.300.0030.00316.41
7.3.290.0090.00616.29
7.3.280.0060.01216.35
7.3.270.0120.00617.40
7.3.260.0120.00616.51
7.3.250.0140.00316.45
7.3.240.0120.00616.61
7.3.230.0070.01116.63
7.3.210.0070.01416.59
7.3.200.0170.00819.39
7.3.190.0100.01316.27
7.3.180.0120.00316.67
7.3.170.0060.00916.57
7.3.160.0050.01116.60
7.3.130.0040.01115.05
7.3.120.0070.00814.81
7.3.110.0070.01014.82
7.3.100.0100.00314.52
7.3.90.0100.00714.82
7.3.80.0000.00914.92
7.3.70.0000.00914.90
7.3.60.0090.00414.98
7.3.50.0030.01014.77
7.3.40.0040.00414.83
7.3.30.0100.00714.61
7.3.20.0000.01516.57
7.3.10.0080.00816.52
7.3.00.0090.00316.56
7.2.330.0060.01816.82
7.2.320.0050.01416.77
7.2.310.0030.01316.77
7.2.300.0060.01516.86
7.2.290.0050.01116.88
7.2.260.0100.00614.98
7.2.250.0070.01015.18
7.2.240.0030.01014.73
7.2.230.0000.01614.68
7.2.220.0090.00615.31
7.2.210.0030.01015.33
7.2.200.0070.01015.29
7.2.190.0000.01215.11
7.2.180.0080.00415.06
7.2.170.0060.00615.06
7.2.160.0100.00315.12
7.2.150.0150.00316.69
7.2.140.0090.00916.54
7.2.130.0000.01116.91
7.2.120.0000.01817.10
7.2.110.0090.00916.99
7.2.100.0100.00716.96
7.2.90.0090.00616.98
7.2.80.0000.01516.74
7.2.70.0070.00716.99
7.2.60.0030.00717.13
7.2.50.0080.00416.98
7.2.40.0090.00616.99
7.2.30.0070.01016.70
7.2.20.0110.00416.77
7.2.10.0030.01316.70
7.2.00.0030.01418.07
7.1.330.0070.00715.59
7.1.320.0040.00715.93
7.1.310.0030.00815.60
7.1.300.0030.00615.88
7.1.290.0030.01215.80
7.1.280.0030.00615.68
7.1.270.0100.00316.00
7.1.260.0040.01215.83
7.1.250.0090.00615.81
7.1.240.0000.01215.59
7.1.230.0090.00315.99
7.1.220.0090.00915.78
7.1.210.0070.00315.89
7.1.200.0030.01315.93
7.1.190.0070.00315.65
7.1.180.0090.00015.72
7.1.170.0000.01615.93
7.1.160.0060.00916.03
7.1.150.0040.00815.68
7.1.140.0040.01215.82
7.1.130.0000.01515.88
7.1.120.0000.01515.79
7.1.110.0080.00815.87
7.1.100.0060.00617.07
7.1.90.0000.01315.98
7.1.80.0110.00316.02
7.1.70.0040.00716.45
7.1.60.0090.00917.44
7.1.50.0090.00916.18
7.1.40.0130.00015.90
7.1.30.0030.01015.68
7.1.20.0070.01015.85
7.1.10.0060.01215.70
7.1.00.0020.04519.07
7.0.330.0090.00315.43
7.0.320.0070.00315.47
7.0.310.0100.00315.50
7.0.300.0030.01315.50
7.0.290.0040.01115.53
7.0.280.0050.00315.63
7.0.270.0030.01015.19
7.0.260.0040.01115.63
7.0.250.0000.01415.53
7.0.240.0040.01115.51
7.0.230.0070.00315.54
7.0.220.0000.01215.33
7.0.210.0030.00915.46
7.0.200.0030.00716.12
7.0.190.0060.00315.23
7.0.180.0070.01015.33
7.0.170.0060.00315.24
7.0.160.0040.01115.54
7.0.150.0000.01715.50
7.0.140.0030.04118.71
7.0.130.0080.00415.53
7.0.120.0040.01115.62
7.0.110.0100.00715.41
7.0.100.0030.00615.44
7.0.90.0000.00915.32
7.0.80.0030.01015.53
7.0.70.0100.00315.43
7.0.60.0080.02517.55
7.0.50.0050.04316.68
7.0.40.0080.02216.92
7.0.30.0180.04016.93
7.0.20.0180.04016.85
7.0.10.0080.02616.83
7.0.00.0080.04316.69
5.6.400.0070.00714.52
5.6.390.0040.01114.18
5.6.380.0070.00714.54
5.6.370.0030.01314.10
5.6.360.0100.00714.70
5.6.350.0030.01414.54
5.6.340.0030.01214.38
5.6.330.0000.01314.61
5.6.320.0060.00914.54
5.6.310.0060.00914.63
5.6.300.0070.01013.98
5.6.290.0060.00914.48
5.6.280.0020.04117.90
5.6.270.0090.00614.73
5.6.260.0070.01014.21
5.6.250.0000.00914.46
5.6.240.0060.00614.29
5.6.230.0030.01214.57
5.6.220.0030.01014.29
5.6.210.0080.04017.48
5.6.200.0050.03416.42
5.6.190.0030.03017.50
5.6.180.0130.04517.55
5.6.170.0120.02517.43
5.6.160.0050.02617.36
5.6.150.0070.04016.42
5.6.140.0070.02316.32
5.6.130.0050.04816.28
5.6.120.0160.03717.73
5.6.110.0120.04517.67
5.6.100.0070.04217.81
5.6.90.0080.03417.64
5.6.80.0060.04617.40
5.6.70.0090.00314.12
5.6.60.0030.01014.17
5.6.50.0040.01114.17
5.6.40.0120.00314.40
5.6.30.0060.00314.32
5.6.20.0140.00314.65
5.6.10.0030.01014.18
5.6.00.0060.00614.27
5.5.380.0140.00314.09
5.5.370.0100.00714.33
5.5.360.0070.00314.46
5.5.350.0120.03817.24
5.5.340.0100.03816.14
5.5.330.0070.04517.29
5.5.320.0200.03217.24
5.5.310.0120.02817.30
5.5.300.0030.02516.15
5.5.290.0030.04416.27
5.5.280.0090.03717.65
5.5.270.0050.02517.45
5.5.260.0100.04317.61
5.5.250.0110.04017.37
5.5.240.2050.02317.23
5.5.230.0000.01414.17
5.5.220.0070.00714.04
5.5.210.0030.00714.14
5.5.200.0070.00714.29
5.5.190.0030.01014.43
5.5.180.0090.00614.25
5.5.170.0080.00814.35
5.5.160.0040.00714.42
5.5.150.0070.00714.44
5.5.140.0080.00314.54
5.5.130.0100.00314.14
5.5.120.0060.00614.04
5.5.110.0090.00614.33
5.5.100.0120.00313.85
5.5.90.0090.00313.81
5.5.80.0070.00713.99
5.5.70.0040.00714.14
5.5.60.0030.00914.26
5.5.50.0100.00314.24
5.5.40.0100.00714.00
5.5.30.0100.00314.48
5.5.20.0030.00614.08
5.5.10.0080.00414.13
5.5.00.0130.00314.39
5.4.450.0200.01823.97
5.4.440.0130.02021.39
5.4.430.0130.02519.16
5.4.420.0080.02718.21
5.4.410.0020.03017.29
5.4.400.0580.03214.97
5.4.390.0200.01816.33
5.4.380.0270.03314.95
5.4.370.0150.03114.87
5.4.360.0150.03014.93
5.4.350.0220.03014.89
5.4.340.0190.02514.91
5.4.330.0140.00011.25
5.4.320.0050.02211.72
5.4.310.0060.02211.91
5.4.300.0100.02711.72
5.4.290.0090.02611.80
5.4.280.0040.03011.72
5.4.270.0080.02711.76
5.4.260.0040.02711.56
5.4.250.0040.02711.71
5.4.240.0040.03311.74
5.4.230.0070.02811.80
5.4.220.0070.02811.61
5.4.210.0040.03111.62
5.4.200.0030.03411.72
5.4.190.0080.02511.59
5.4.180.0070.02611.56
5.4.170.0040.03011.55
5.4.160.0050.02811.77
5.4.150.0090.02811.62
5.4.140.0080.02711.46
5.4.130.0020.03011.61
5.4.120.0060.02811.61
5.4.110.0080.02911.42
5.4.100.0050.02711.42
5.4.90.0090.02611.49
5.4.80.0050.03011.38
5.4.70.0060.02811.56
5.4.60.0040.02811.53
5.4.50.0040.03311.52
5.4.40.0060.02711.58
5.4.30.0070.02811.55
5.4.20.0090.02711.51
5.4.10.0050.03011.50
5.4.00.0040.02811.35
5.3.290.0060.02011.80
5.3.280.0060.02911.60
5.3.270.0080.02611.71
5.3.260.0070.03611.72
5.3.250.0070.02911.55
5.3.240.0080.02711.70
5.3.230.0040.03011.58
5.3.220.0060.02811.47
5.3.210.0080.03011.62
5.3.200.0050.02911.61
5.3.190.0080.02711.51
5.3.180.0050.02811.74
5.3.170.0070.02711.70
5.3.160.0070.02711.70
5.3.150.0080.02711.65
5.3.140.0050.02811.64
5.3.130.0080.02611.66
5.3.120.0050.02911.62
5.3.110.0060.02811.66
5.3.100.0030.03011.31
5.3.90.0040.02811.40
5.3.80.0080.02511.31
5.3.70.0080.02311.20
5.3.60.0050.02611.31
5.3.50.0040.02811.20
5.3.40.0070.02611.26
5.3.30.0090.02411.21
5.3.20.0080.02311.18
5.3.10.0040.03011.05
5.3.00.0070.02710.91
5.2.170.0080.0429.23
5.2.160.0100.0389.23
5.2.150.0050.0429.23
5.2.140.0040.0439.22
5.2.130.0060.0399.19
5.2.120.0050.0419.18
5.2.110.0070.0399.19
5.2.100.0090.0379.18
5.2.90.0100.0389.18
5.2.80.0120.0369.18
5.2.70.0090.0389.18
5.2.60.0030.0439.14
5.2.50.0060.0429.10
5.2.40.0060.0389.09
5.2.30.0100.0389.05
5.2.20.0080.0379.05
5.2.10.0040.0418.95
5.2.00.0060.0428.82
5.1.60.0040.0368.10
5.1.50.0060.0338.10
5.1.40.0060.0358.08
5.1.30.0050.0398.43
5.1.20.0090.0348.45
5.1.10.0070.0358.18
5.1.00.0060.0368.18
5.0.50.0050.0286.67
5.0.40.0040.0286.53
5.0.30.0040.0386.34
5.0.20.0060.0186.30
5.0.10.0080.0166.29
5.0.00.0060.0286.28
4.4.90.0030.0154.78
4.4.80.0000.0184.76
4.4.70.0020.0164.75
4.4.60.0030.0154.75
4.4.50.0020.0164.77
4.4.40.0030.0274.71
4.4.30.0030.0174.76
4.4.20.0050.0174.85
4.4.10.0030.0234.85
4.4.00.0050.0244.75
4.3.110.0020.0224.67
4.3.100.0020.0154.66
4.3.90.0040.0144.63
4.3.80.0010.0264.58
4.3.70.0050.0144.63
4.3.60.0040.0144.63
4.3.50.0040.0174.63
4.3.40.0040.0234.54
4.3.30.0040.0143.32
4.3.20.0030.0173.31
4.3.10.0030.0173.26
4.3.00.0030.01720.50

preferences:
42.84 ms | 401 KiB | 5 Q