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.0110.01116.75
8.3.50.0110.01122.12
8.3.40.0040.01118.71
8.3.30.0160.00318.95
8.3.20.0040.00420.18
8.3.10.0070.00023.52
8.3.00.0040.00419.15
8.2.180.0070.01416.32
8.2.170.0150.00022.96
8.2.160.0100.00320.24
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0080.00020.79
8.2.110.0110.00020.97
8.2.100.0040.00817.78
8.2.90.0040.00418.96
8.2.80.0000.00817.97
8.2.70.0040.00417.38
8.2.60.0050.00317.68
8.2.50.0090.00018.10
8.2.40.0040.00422.29
8.2.30.0040.00719.06
8.2.20.0000.00817.55
8.2.10.0000.00717.80
8.2.00.0000.00817.59
8.1.280.0070.01325.92
8.1.270.0060.00323.90
8.1.260.0070.00026.35
8.1.250.0030.00528.09
8.1.240.0030.00621.24
8.1.230.0070.00417.70
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0090.00017.22
8.1.190.0000.00817.10
8.1.180.0040.00418.10
8.1.170.0000.00818.57
8.1.160.0040.00418.76
8.1.150.0000.00719.99
8.1.140.0040.00417.27
8.1.130.0030.00317.75
8.1.120.0000.00717.25
8.1.110.0000.00717.31
8.1.100.0040.00417.34
8.1.90.0050.00317.35
8.1.80.0000.00717.29
8.1.70.0030.00317.29
8.1.60.0030.00617.47
8.1.50.0050.00317.43
8.1.40.0000.00717.38
8.1.30.0040.00417.52
8.1.20.0000.00817.42
8.1.10.0090.00017.36
8.1.00.0000.00717.37
8.0.300.0000.00718.77
8.0.290.0050.00316.75
8.0.280.0000.00718.31
8.0.270.0030.00317.13
8.0.260.0060.00017.16
8.0.250.0030.00316.92
8.0.240.0000.00716.80
8.0.230.0040.00416.82
8.0.220.0030.00316.88
8.0.210.0050.00316.82
8.0.200.0060.00016.88
8.0.190.0000.00716.91
8.0.180.0040.00416.77
8.0.170.0000.00816.73
8.0.160.0030.00316.87
8.0.150.0030.00416.80
8.0.140.0000.00716.77
8.0.130.0000.00713.25
8.0.120.0000.00816.69
8.0.110.0000.00816.77
8.0.100.0000.00816.71
8.0.90.0050.00216.77
8.0.80.0080.00716.78
8.0.70.0050.00316.67
8.0.60.0040.00416.82
8.0.50.0050.00216.63
8.0.30.0110.01116.86
8.0.20.0060.01317.40
8.0.10.0040.00416.80
8.0.00.0100.01016.56
7.4.330.0030.00315.07
7.4.320.0030.00316.83
7.4.300.0040.00416.68
7.4.290.0040.00416.88
7.4.280.0000.00916.89
7.4.270.0070.00316.91
7.4.260.0050.00316.91
7.4.250.0000.00716.65
7.4.240.0060.00116.71
7.4.230.0000.00716.72
7.4.220.0120.00616.90
7.4.210.0090.00716.81
7.4.200.0070.00016.79
7.4.190.0030.00316.96
7.4.160.0110.00516.89
7.4.150.0120.00617.40
7.4.140.0070.01117.86
7.4.130.0110.00916.75
7.4.120.0070.01316.92
7.4.110.0100.00716.96
7.4.100.0090.01316.82
7.4.90.0070.01016.92
7.4.80.0110.00719.39
7.4.70.0070.01016.88
7.4.60.0140.01116.87
7.4.50.0000.00416.70
7.4.40.0060.01016.73
7.4.30.0080.00816.60
7.4.00.0100.00715.17
7.3.330.0000.00613.35
7.3.320.0000.00513.63
7.3.310.0000.00716.47
7.3.300.0030.00316.48
7.3.290.0120.00316.63
7.3.280.0080.01016.59
7.3.270.0150.00317.40
7.3.260.0050.01516.67
7.3.250.0120.00916.52
7.3.240.0100.00716.54
7.3.230.0260.01816.61
7.3.210.0100.01016.57
7.3.200.0100.01019.39
7.3.190.0120.00916.63
7.3.180.0130.00316.64
7.3.170.0080.00816.77
7.3.160.0090.00616.85
7.3.120.0000.01415.39
7.2.330.0030.01517.02
7.2.320.0090.01116.89
7.2.310.0110.00716.76
7.2.300.0000.01816.82
7.2.290.0070.01716.76
7.2.00.0040.00819.71
7.1.100.0040.01218.16
7.1.70.0100.00317.58
7.1.60.0130.01319.46
7.1.50.0030.01717.24
7.1.00.0100.06722.37
7.0.200.0080.00316.83
7.0.140.0000.07722.07
7.0.60.0070.08319.96
7.0.50.0030.04017.92
7.0.40.0070.07320.31
7.0.30.0200.05020.10
7.0.20.0170.04020.20
7.0.10.0030.05720.20
7.0.00.0130.08020.17
5.6.280.0030.07321.00
5.6.210.0130.07720.78
5.6.200.0070.07718.24
5.6.190.0170.07320.60
5.6.180.0100.04320.77
5.6.170.0270.04720.51
5.6.160.0070.07720.43
5.6.150.0070.08718.27
5.6.140.0070.07718.19
5.6.130.0070.07018.28
5.6.120.0070.07021.11
5.6.110.0100.08721.09
5.6.100.0070.08021.03
5.6.90.0030.04321.04
5.6.80.0100.06020.53
5.5.350.0070.04320.51
5.5.340.0130.07318.05
5.5.330.0070.05320.32
5.5.320.0300.04320.42
5.5.310.0400.04720.37
5.5.300.0070.08018.08
5.5.290.0030.08717.98
5.5.280.0070.08020.75
5.5.270.0230.04020.79
5.5.260.0100.08020.88
5.5.250.0130.05720.63
5.5.240.0000.04320.38
5.4.450.0570.05719.59
5.4.440.0700.05319.70
5.4.430.0030.06019.58
5.4.420.0100.05319.56
5.4.410.0970.06019.36
5.4.400.0870.04719.09
5.4.390.1000.05019.09
5.4.380.0470.06018.46
5.4.370.0730.06718.61
5.4.360.0430.07318.74
5.4.350.0570.06718.55
5.4.340.0400.04718.84
5.4.320.0050.03912.52
5.4.310.0070.03712.52
5.4.300.0090.04812.52
5.4.290.0120.05312.52
5.4.280.0080.04812.41
5.4.270.0120.06012.41
5.4.260.0120.04312.41
5.4.250.0060.05412.41
5.4.240.0080.05212.41
5.4.230.0060.05512.41
5.4.220.0080.05212.40
5.4.210.0100.05212.40
5.4.200.0140.05012.40
5.4.190.0090.05412.40
5.4.180.0180.07712.40
5.4.170.0130.08312.40
5.4.160.0140.08412.40
5.4.150.0140.09112.39
5.4.140.0190.10412.09
5.4.130.0160.09812.07
5.4.120.0140.10612.03
5.4.110.0120.09912.02
5.4.100.0200.10112.02
5.4.90.0090.04612.03
5.4.80.0130.04912.02
5.4.70.0130.05312.02
5.4.60.0060.05912.02
5.4.50.0090.05312.02
5.4.40.0110.05912.01
5.4.30.0110.05012.01
5.4.20.0130.05312.00
5.4.10.0110.05212.00
5.4.00.0090.06011.50
5.3.290.0120.03912.80
5.3.280.0170.06312.71
5.3.270.0130.06012.73
5.3.260.0160.06612.71
5.3.250.0100.06312.72
5.3.240.0100.06912.72
5.3.230.0130.05312.71
5.3.220.0090.06012.68
5.3.210.0080.06112.68
5.3.200.0080.05912.68
5.3.190.0080.05912.68
5.3.180.0060.06312.68
5.3.170.0160.07712.67
5.3.160.0190.06512.67
5.3.150.0110.06412.67
5.3.140.0110.06012.66
5.3.130.0150.06212.66
5.3.120.0180.10612.66
5.3.110.0140.08912.66
5.3.100.0060.05212.14
5.3.90.0050.05412.12
5.3.80.0120.05712.11
5.3.70.0050.05112.11
5.3.60.0080.04512.10
5.3.50.0130.05512.04
5.3.40.0190.07312.05
5.3.30.0130.06212.00
5.3.20.0090.06011.79
5.3.10.0120.05611.75
5.3.00.0130.06211.73
5.2.170.0180.0469.25
5.2.160.0050.0559.25
5.2.150.0080.0669.25
5.2.140.0140.0579.25
5.2.130.0070.0529.20
5.2.120.0120.0419.21
5.2.110.0080.0479.21
5.2.100.0110.0479.20
5.2.90.0240.0609.20
5.2.80.0100.0489.19
5.2.70.0080.0459.19
5.2.60.0050.0489.15
5.2.50.0100.0409.12
5.2.40.0050.0479.10
5.2.30.0020.0539.07
5.2.20.0060.0449.06
5.2.10.0040.0478.96
5.2.00.0070.0468.82
5.1.60.0080.0378.11
5.1.50.0100.0468.11
5.1.40.0160.0478.08
5.1.30.0130.0498.43
5.1.20.0070.0388.45
5.1.10.0050.0378.19
5.1.00.0060.0398.18
5.0.50.0070.0276.66
5.0.40.0040.0286.53
5.0.30.0080.0486.34
5.0.20.0090.0306.30
5.0.10.0060.0316.29
5.0.00.0110.0446.28
4.4.90.0050.0274.77
4.4.80.0080.0204.75
4.4.70.0040.0234.76
4.4.60.0060.0214.75
4.4.50.0050.0264.77
4.4.40.0050.0384.71
4.4.30.0090.0194.75
4.4.20.0040.0264.84
4.4.10.0070.0244.85
4.4.00.0080.0334.76
4.3.110.0040.0234.67
4.3.100.0060.0224.66
4.3.90.0070.0314.63
4.3.80.0040.0424.58
4.3.70.0020.0234.63
4.3.60.0050.0244.63
4.3.50.0150.0634.63
4.3.40.0020.0334.54
4.3.30.0060.0413.32
4.3.20.0060.0343.30
4.3.10.0030.0203.27
4.3.00.0100.0177.06

preferences:
62.26 ms | 401 KiB | 5 Q