3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * ord() alternative that works with UTF8 characters * @param string $c * * @return int UTF-8 character code value */ function getUTF8CharCode($c) { $h = ord($c{0}); if ($h <= 0x7F) { return $h; } else if ($h < 0xC2) { return false; } else if ($h <= 0xDF) { return ($h & 0x1F) << 6 | (ord($c{1}) & 0x3F); } else if ($h <= 0xEF) { return ($h & 0x0F) << 12 | (ord($c{1}) & 0x3F) << 6 | (ord($c{2}) & 0x3F); } else if ($h <= 0xF4) { return ($h & 0x0F) << 18 | (ord($c{1}) & 0x3F) << 12 | (ord($c{2}) & 0x3F) << 6 | (ord($c{3}) & 0x3F); } else { return -1; } } /** * Escape a single character for CSS context. * @param $c * @return string */ function escapeCSSCharacter($c) { return "\\" . base_convert(getUTF8CharCode($c), 10, 16) . " "; } /** * Escape CSS rule * * @param string $data The CSS rule * @param array $immuneChars Array of immune character. These characters will not be escaped. * * @return string Escaped string */ function escapeCSSValue($data, array $immuneChars = array()) { $result = ""; for ($i = 0; $i < mb_strlen($data); $i++) { $currChar = mb_substr($data, $i, 1); if (getUTF8CharCode($currChar) < 256 && //Character value is less than 256 !preg_match("/^\w$/", $currChar) && //Character is not alphanumeric (underscore is considered safe too) !in_array($currChar, $immuneChars) //Character is not immune ) { $result .= escapeCSSCharacter($currChar); } else { $result .= $currChar; } } return $result; } $colorRule = "color: " . escapeCSSValue("#BADA55;}*{display:none;}", array("#")) . ";"; //Will be obviously broken, but will not break the rest of the document. echo $colorRule;

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.0120.00916.63
8.3.50.0070.00822.01
8.3.40.0140.00018.72
8.3.30.0110.00718.79
8.3.20.0000.00720.38
8.3.10.0030.00523.66
8.3.00.0000.00819.19
8.2.180.0120.00616.38
8.2.170.0040.01122.96
8.2.160.0100.00320.53
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00020.85
8.2.110.0000.00922.27
8.2.100.0060.00617.72
8.2.90.0000.00819.18
8.2.80.0040.00417.97
8.2.70.0000.00817.38
8.2.60.0030.00617.80
8.2.50.0060.00318.07
8.2.40.0050.00321.19
8.2.30.0040.00418.10
8.2.20.0040.00417.59
8.2.10.0030.00517.89
8.2.00.0080.00017.42
8.1.280.0130.01025.92
8.1.270.0000.00823.82
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00321.98
8.1.230.0100.00019.00
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0070.00317.23
8.1.190.0050.00317.10
8.1.180.0000.00818.10
8.1.170.0030.00518.72
8.1.160.0040.00421.88
8.1.150.0050.00318.55
8.1.140.0070.00017.30
8.1.130.0070.00017.66
8.1.120.0030.00317.33
8.1.110.0000.00717.23
8.1.100.0000.00817.41
8.1.90.0000.00817.21
8.1.80.0040.00417.31
8.1.70.0070.00017.25
8.1.60.0030.00617.42
8.1.50.0000.00717.29
8.1.40.0040.00417.44
8.1.30.0090.00017.41
8.1.20.0030.00517.50
8.1.10.0040.00717.39
8.1.00.0040.00417.21
8.0.300.0040.00418.77
8.0.290.0000.00716.90
8.0.280.0000.00718.36
8.0.270.0000.00817.00
8.0.260.0030.00317.18
8.0.250.0070.00016.90
8.0.240.0030.00316.89
8.0.230.0070.00016.77
8.0.220.0030.00316.89
8.0.210.0040.00416.86
8.0.200.0070.00016.75
8.0.190.0030.00316.82
8.0.180.0000.00716.86
8.0.170.0000.00716.83
8.0.160.0000.00716.85
8.0.150.0000.00716.80
8.0.140.0040.00416.66
8.0.130.0040.00413.24
8.0.120.0040.00416.68
8.0.110.0040.00416.89
8.0.100.0000.00716.86
8.0.90.0050.00216.79
8.0.80.0040.01116.80
8.0.70.0040.00416.86
8.0.60.0000.00716.64
8.0.50.0040.00416.70
8.0.30.0090.01017.12
8.0.20.0130.00717.40
8.0.10.0050.00216.88
8.0.00.0100.01016.69
7.4.330.0050.00015.20
7.4.320.0030.00516.89
7.4.300.0040.00416.73
7.4.290.0030.00616.80
7.4.280.0000.00816.85
7.4.270.0060.00316.73
7.4.260.0000.00716.79
7.4.250.0070.00016.89
7.4.240.0000.00716.85
7.4.230.0000.00716.90
7.4.220.0210.00416.82
7.4.210.0090.00816.83
7.4.200.0040.00416.94
7.4.190.0070.00017.02
7.4.160.0060.00916.79
7.4.150.0060.01217.40
7.4.140.0110.00817.86
7.4.130.0050.01516.76
7.4.120.0060.01616.80
7.4.110.0110.00716.77
7.4.100.0180.00316.96
7.4.90.0100.00716.82
7.4.80.0070.01019.39
7.4.70.0070.01116.85
7.4.60.0150.01016.91
7.4.50.0030.00316.76
7.4.40.0090.00616.71
7.4.30.0140.00316.62
7.4.00.0030.01215.24
7.3.330.0000.00513.54
7.3.320.0000.00513.43
7.3.310.0070.00016.52
7.3.300.0030.00316.58
7.3.290.0090.00616.59
7.3.280.0090.00816.59
7.3.270.0030.01617.40
7.3.260.0090.01416.59
7.3.250.0120.00816.69
7.3.240.0060.01616.63
7.3.230.0140.00316.62
7.3.210.0090.00916.59
7.3.200.0070.01019.39
7.3.190.0130.00316.82
7.3.180.0130.00316.78
7.3.170.0120.01216.54
7.3.160.0060.00916.93
7.3.120.0060.00915.16
7.3.110.0060.01215.30
7.3.100.0070.00715.31
7.3.90.0060.00915.13
7.3.80.0080.00715.43
7.3.70.0070.00714.81
7.3.60.0040.01114.94
7.3.50.0000.01214.96
7.3.40.0030.01214.84
7.3.30.0040.01114.99
7.3.20.0100.00616.93
7.3.10.0060.00616.90
7.3.00.0040.00817.01
7.2.330.0120.00617.05
7.2.320.0120.00616.90
7.2.310.0120.01216.93
7.2.300.0100.00717.03
7.2.290.0120.00816.72
7.2.250.0000.01715.40
7.2.240.0080.01215.27
7.2.230.0060.00615.44
7.2.220.0100.00715.15
7.2.210.0060.00615.33
7.2.200.0040.01114.96
7.2.190.0030.01015.11
7.2.180.0030.00615.39
7.2.170.0040.01115.25
7.2.60.0050.01016.88
7.2.00.0000.01219.73
7.1.330.0030.01016.25
7.1.320.0090.00615.98
7.1.310.0080.00416.13
7.1.300.0070.00715.86
7.1.290.0070.00715.83
7.1.280.0140.00315.89
7.1.270.0000.01515.93
7.1.260.0000.00916.01
7.1.200.0070.00715.91
7.1.100.0130.01317.91
7.1.70.0070.01017.39
7.1.60.0140.01119.46
7.1.50.0040.01517.18
7.1.00.0030.07722.29
7.0.200.0060.00316.98
7.0.140.0100.07022.05
7.0.60.0130.07719.89
7.0.50.0030.04017.93
7.0.40.0100.08720.29
7.0.30.0370.07020.26
7.0.20.0130.04320.34
7.0.10.0100.08720.24
7.0.00.0100.05720.16
5.6.280.0000.07720.82
5.6.210.0100.07020.67
5.6.200.0100.04018.21
5.6.190.0070.05320.68
5.6.180.0100.05720.48
5.6.170.0270.05320.52
5.6.160.0100.04720.51
5.6.150.0070.04018.28
5.6.140.0100.03718.14
5.6.130.0000.05318.21
5.6.120.0030.04321.13
5.6.110.0070.07720.98
5.6.100.0130.06720.99
5.6.90.0070.04020.96
5.6.80.0070.06320.40
5.5.350.0130.03720.42
5.5.340.0070.07717.96
5.5.330.0100.04020.38
5.5.320.0300.04020.31
5.5.310.0300.07320.28
5.5.300.0030.07317.96
5.5.290.0070.05317.93
5.5.280.0000.06720.78
5.5.270.0100.06320.99
5.5.260.0030.08020.70
5.5.250.0070.08720.51
5.5.240.0070.03320.25
5.4.450.0630.05719.61
5.4.440.0770.04719.63
5.4.430.0800.05319.52
5.4.420.0930.05019.56
5.4.410.0900.08019.42
5.4.400.1100.06719.20
5.4.390.1030.05319.20
5.4.380.0400.05718.45
5.4.370.0330.05318.79
5.4.360.0270.08318.55
5.4.350.0430.04718.61
5.4.340.0400.04718.77
5.4.320.0050.04212.52
5.4.310.0080.03712.52
5.4.300.0070.04212.52
5.4.290.0110.03912.51
5.4.280.0070.04112.41
5.4.270.0100.04012.41
5.4.260.0080.04412.41
5.4.250.0080.04512.41
5.4.240.0080.04612.41
5.4.230.0080.03912.40
5.4.220.0080.04712.41
5.4.210.0070.04512.40
5.4.200.0090.04512.40
5.4.190.0060.05412.40
5.4.180.0120.05212.40
5.4.170.0100.04312.40
5.4.160.0080.04312.40
5.4.150.0060.04212.40
5.4.140.0070.04012.08
5.4.130.0080.04712.07
5.4.120.0070.04012.03
5.4.110.0040.04312.03
5.4.100.0050.03912.02
5.4.90.0110.03512.02
5.4.80.0070.04112.03
5.4.70.0090.03612.02
5.4.60.0070.03412.02
5.4.50.0090.03812.02
5.4.40.0060.04212.01
5.4.30.0070.04412.00
5.4.20.0070.04212.01
5.4.10.0100.03712.00
5.4.00.0060.04111.50
5.3.290.0110.04812.80
5.3.280.0050.05312.71
5.3.270.0110.05012.73
5.3.260.0110.05112.72
5.3.250.0070.05412.72
5.3.240.0100.05112.72
5.3.230.0080.04812.71
5.3.220.0050.05212.68
5.3.210.0130.04812.68
5.3.200.0080.04712.68
5.3.190.0080.03812.68
5.3.180.0050.04112.67
5.3.170.0110.04712.67
5.3.160.0080.05312.67
5.3.150.0050.05112.67
5.3.140.0030.05712.66
5.3.130.0030.06012.66
5.3.120.0090.05412.66
5.3.110.0080.05512.66
5.3.100.0080.05012.14
5.3.90.0130.04812.12
5.3.80.0070.05012.11
5.3.70.0100.04812.11
5.3.60.0070.04912.09
5.3.50.0070.05012.04
5.3.40.0070.05112.04
5.3.30.0080.04912.00
5.3.20.0090.04711.79
5.3.10.0100.04611.75
5.3.00.0080.04911.73
5.2.170.0090.0399.24
5.2.160.0080.0409.25
5.2.150.0090.0439.25
5.2.140.0070.0509.25
5.2.130.0050.0499.21
5.2.120.0110.0369.20
5.2.110.0090.0369.21
5.2.100.0070.0299.20
5.2.90.0040.0339.20
5.2.80.0070.0479.19
5.2.70.0060.0469.19
5.2.60.0080.0439.16
5.2.50.0060.0499.13
5.2.40.0080.0429.10
5.2.30.0070.0459.07
5.2.20.0090.0379.06
5.2.10.0060.0408.96
5.2.00.0080.0418.82
5.1.60.0130.0308.11
5.1.50.0090.0338.11
5.1.40.0080.0338.09
5.1.30.0060.0388.43
5.1.20.0080.0378.46
5.1.10.0080.0378.18
5.1.00.0090.0378.19
5.0.50.0060.0296.67
5.0.40.0100.0236.53
5.0.30.0120.0356.34
5.0.20.0100.0236.30
5.0.10.0120.0546.29
5.0.00.0150.0836.28
4.4.90.0040.0224.78
4.4.80.0040.0224.75
4.4.70.0040.0224.75
4.4.60.0050.0224.75
4.4.50.0080.0174.77
4.4.40.0060.0304.71
4.4.30.0070.0194.76
4.4.20.0020.0234.85
4.4.10.0060.0184.85
4.4.00.0050.0304.76
4.3.110.0060.0174.67
4.3.100.0030.0204.66
4.3.90.0040.0204.64
4.3.80.0030.0314.59
4.3.70.0050.0174.63
4.3.60.0050.0174.63
4.3.50.0030.0204.63
4.3.40.0030.0304.54
4.3.30.0040.0193.32
4.3.20.0020.0213.30
4.3.10.0040.0173.26
4.3.00.0000.0277.06

preferences:
58.21 ms | 400 KiB | 5 Q