3v4l.org

run code in 300+ PHP versions simultaneously
<?php function make_literal($s) { $chars = [0x09 => "\t","\n",".","\f","\r", 0x20 => " ","!","\"","#","\$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~"]; return implode("", array_map(fn($c) => $chars[ord($c)], str_split($s, 1))); } function test($s) { echo "is_literal = ", (is_literal($s) ? "true" : "false"), " for: $s\n"; } $a = "test"; test($a); test(strtoupper($a)); test(make_literal(strtoupper($a))); test(make_literal(json_encode($_SERVER)));

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.0040.01516.63
8.3.50.0070.01116.46
8.3.40.0040.01119.00
8.3.30.0040.01118.78
8.3.20.0050.00224.18
8.3.10.0030.00724.66
8.3.00.0080.00026.16
8.2.180.0210.00025.92
8.2.170.0040.01118.96
8.2.160.0070.00722.96
8.2.150.0070.00025.66
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0060.00326.16
8.2.110.0040.00420.34
8.2.100.0060.00617.84
8.2.90.0000.00817.91
8.2.80.0000.01017.97
8.2.70.0040.00417.50
8.2.60.0000.00817.75
8.2.50.0000.00817.75
8.2.40.0040.00419.95
8.2.30.0070.00017.86
8.2.20.0050.00317.92
8.2.10.0040.00419.25
8.2.00.0040.00419.16
8.1.280.0140.00725.92
8.1.270.0070.01124.01
8.1.260.0050.00226.35
8.1.250.0030.00528.09
8.1.240.0080.00422.08
8.1.230.0090.00324.03
8.1.220.0000.00917.77
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0000.00917.22
8.1.180.0050.00318.10
8.1.170.0040.00418.99
8.1.160.0040.00419.08
8.1.150.0000.00718.93
8.1.140.0040.00418.89
8.1.130.0040.00419.16
8.1.120.0030.00717.45
8.1.110.0000.00817.42
8.1.100.0040.00717.39
8.1.90.0040.00417.43
8.1.80.0000.01017.35
8.1.70.0000.00717.34
8.1.60.0060.00317.47
8.1.50.0030.00617.44
8.1.40.0000.00917.42
8.1.30.0050.00317.58
8.1.20.0040.00417.60
8.1.10.0040.00417.50
8.1.00.0080.00017.59
8.0.300.0000.00720.08
8.0.290.0040.00416.75
8.0.280.0070.00018.50
8.0.270.0040.00418.10
8.0.260.0030.00316.87
8.0.250.0000.00816.96
8.0.240.0000.00716.86
8.0.230.0030.00317.04
8.0.220.0000.00716.90
8.0.210.0050.00216.95
8.0.200.0030.00316.98
8.0.190.0000.00816.91
8.0.180.0000.00816.94
8.0.170.0050.00316.93
8.0.160.0000.00916.85
8.0.150.0070.00016.88
8.0.140.0070.00016.87
8.0.130.0060.00013.38
8.0.120.0040.00416.92
8.0.110.0040.00416.75
8.0.100.0000.00716.88
8.0.90.0040.00417.03
8.0.80.0060.01116.88
8.0.70.0000.00716.76
8.0.60.0070.00016.79
8.0.50.0070.00016.78
8.0.30.0250.01016.66
8.0.20.0290.00316.64
8.0.10.0280.00516.81
8.0.00.0070.01016.93
7.4.330.0000.00415.55
7.4.320.0000.00616.55
7.4.300.0040.00416.52
7.4.290.0030.00516.48
7.4.280.0030.00716.66
7.4.270.0040.00416.61
7.4.260.0050.00013.30
7.4.250.0040.00416.39
7.4.240.0020.00616.63
7.4.230.0070.00016.39
7.4.220.0000.00816.69
7.4.210.0050.01216.57
7.4.200.0070.00016.43
7.4.160.0250.00716.36
7.4.150.0080.02016.38
7.4.140.0170.01716.19
7.4.130.0220.00716.33
7.4.120.0160.01116.24
7.4.110.0220.00716.17
7.4.100.0260.00816.43
7.4.90.0220.00416.21
7.4.80.0250.00816.36
7.4.70.0210.00816.39
7.4.60.0230.00816.40
7.4.50.0260.00216.32
7.4.40.0270.00916.41
7.4.30.0160.01616.45
7.4.20.0260.00016.35
7.4.10.0160.01316.36
7.4.00.0140.01416.42
7.3.330.0070.00016.20
7.3.320.0030.00313.22
7.3.310.0000.00716.18
7.3.300.0000.00716.16
7.3.290.0070.01116.20
7.3.280.0180.00916.13
7.3.270.0120.01616.15
7.3.260.0210.00616.20
7.3.250.0290.00316.18
7.3.240.0210.01116.17
7.3.230.0120.01516.17
7.3.220.0230.00716.11
7.3.210.0200.01316.08
7.3.200.0230.00316.03
7.3.190.0260.00216.07
7.3.180.0300.00816.13
7.3.170.0290.00616.12
7.3.160.0210.00816.11
7.3.150.0270.01416.11
7.3.140.0210.00916.17
7.3.130.0230.00716.05
7.3.120.0130.01316.12
7.3.110.0270.00015.98
7.3.100.0210.00815.98
7.3.90.0180.00716.34
7.3.80.0190.00916.12
7.3.70.0140.01016.18
7.3.60.0110.01416.22
7.3.50.0200.01216.27
7.3.40.0190.01016.17
7.3.30.0300.00816.15
7.3.20.0250.00416.19
7.3.10.0120.01516.16
7.3.00.0230.00416.18

preferences:
69.61 ms | 401 KiB | 5 Q