3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DomainName { private $name; private $escapedName; public function __construct($name) { $decodeUnicodeName = static::decodeUnicode($name); $this->name = $decodeUnicodeName; $this->escapedName = static::escapeDomainName($decodeUnicodeName); } public function containsSubdomain() { return substr_count($this->name, '.') >= 2; } public static function escapeDomainName($name) { return preg_replace('/\./', '-', $name); } public static function decodeUnicode(string $name): string { return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) { return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); }, $name); } public function __toString(): string { return (string)$this->name; } } $name = 'apotheke-altenessen-s\u00fcd.de'; $test = new DomainName($name); print_r((string)$test);

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.0150.00418.28
8.3.50.0120.00318.14
8.3.40.0060.00918.82
8.3.30.0150.00419.01
8.3.20.0030.00519.19
8.3.10.0060.00321.73
8.3.00.0000.00720.58
8.2.180.0140.00718.73
8.2.170.0120.00322.96
8.2.160.0070.00722.23
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0110.00018.21
8.2.120.0000.00826.35
8.2.110.0060.00319.30
8.2.100.0100.00319.88
8.2.90.0080.00018.00
8.2.80.0030.00617.97
8.2.70.0030.00518.05
8.2.60.0040.00418.21
8.2.50.0040.00418.10
8.2.40.0000.00821.21
8.2.30.0000.00719.48
8.2.20.0060.00318.23
8.2.10.0020.00518.11
8.2.00.0000.00817.87
8.1.280.0110.01125.92
8.1.270.0050.00320.65
8.1.260.0110.00026.35
8.1.250.0000.00828.09
8.1.240.0090.00022.19
8.1.230.0030.00721.98
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0000.00817.48
8.1.180.0060.00618.10
8.1.170.0040.00418.82
8.1.160.0000.00818.91
8.1.150.0000.00718.96
8.1.140.0000.00722.14
8.1.130.0040.00422.08
8.1.120.0030.00517.77
8.1.110.0000.00717.71
8.1.100.0040.00417.70
8.1.90.0080.00017.59
8.1.80.0040.00417.73
8.1.70.0040.00417.68
8.1.60.0090.00017.79
8.1.50.0040.00417.80
8.1.40.0040.00417.79
8.1.30.0040.00417.87
8.1.20.0000.00817.77
8.1.10.0050.00317.81
8.1.00.0040.00417.67
8.0.300.0040.00418.77
8.0.290.0030.00717.00
8.0.280.0070.00018.54
8.0.270.0040.00417.23
8.0.260.0030.00318.55
8.0.250.0080.00017.16
8.0.240.0000.00817.18
8.0.230.0030.00317.18
8.0.220.0000.00717.12
8.0.210.0050.00317.14
8.0.200.0030.00317.07
8.0.190.0040.00417.25
8.0.180.0000.00817.04
8.0.170.0060.00317.20
8.0.160.0000.00717.04
8.0.150.0060.00317.04
8.0.140.0000.00717.10
8.0.130.0060.00013.59
8.0.120.0000.00817.14
8.0.110.0040.00417.14
8.0.100.0000.00817.14
8.0.90.0070.00016.98
8.0.80.0080.01117.11
8.0.70.0040.00417.16
8.0.60.0040.00417.15
8.0.50.0050.00217.13
8.0.30.0120.00417.22
8.0.20.0080.01017.40
8.0.10.0000.00717.05
8.0.00.0120.00716.81
7.4.330.0060.00015.55
7.4.320.0030.00316.92
7.4.300.0000.00716.88
7.4.290.0070.00016.78
7.4.280.0000.00916.69
7.4.270.0030.00316.89
7.4.260.0030.00316.68
7.4.250.0000.00716.77
7.4.240.0080.00016.81
7.4.230.0070.00016.68
7.4.220.0000.00716.99
7.4.210.0050.01016.80
7.4.200.0070.00016.73
7.4.160.0100.01016.77
7.4.140.0120.01017.86
7.4.130.0100.00716.80
7.4.120.0100.00816.84
7.4.110.0070.01716.65
7.4.100.0100.00716.77
7.4.90.0110.00716.98
7.4.80.0120.00419.39
7.4.70.0070.01116.70
7.4.60.0080.00816.66
7.4.50.0090.00316.67
7.4.40.0070.01016.87
7.4.00.0030.00915.31
7.3.330.0000.00513.54
7.3.320.0000.00513.58
7.3.310.0040.00416.41
7.3.300.0000.00816.59
7.3.290.0030.00316.57
7.3.280.0130.00616.54
7.3.260.0120.00816.68
7.3.240.0110.00816.69
7.3.230.0140.00316.77
7.3.210.0130.00716.62
7.3.200.0070.01116.72
7.3.190.0100.01316.89
7.3.180.0060.00916.67
7.3.170.0070.01016.48
7.3.160.0040.01216.75
7.2.330.0240.00016.87
7.2.320.0140.00416.89
7.2.310.0030.01516.97
7.2.300.0070.01016.84
7.2.290.0100.01017.07
7.2.110.0550.00915.11
7.2.100.0220.00815.05
7.2.90.0690.00014.84
7.2.80.0620.01414.74
7.2.70.0630.01115.49
7.2.60.0830.00915.24
7.2.50.0830.00715.48
7.2.40.0650.00315.09
7.2.30.0260.00015.20
7.2.20.0590.00315.23
7.2.10.0680.00715.32
7.2.00.0590.01215.13
7.1.230.0590.00914.22
7.1.220.0530.00914.18
7.1.210.0610.01314.11
7.1.200.0670.01714.21
7.1.190.0620.00913.92
7.1.180.0670.01113.85
7.1.170.0580.00314.06
7.1.160.1030.00714.02
7.1.150.0220.01414.19
7.1.140.0540.00614.23
7.1.130.0630.00413.67
7.1.120.0450.01314.41
7.1.110.0900.00413.98
7.1.100.0730.00714.19
7.1.90.0670.01014.12
7.1.80.0160.00614.29
7.1.70.0460.00614.16
7.1.60.0790.01032.25
7.1.50.1420.01032.04
7.1.40.1260.01632.15
7.1.30.1120.01632.30
7.1.20.0340.01232.28
7.1.10.0970.01614.14
7.1.00.0910.00914.03
5.6.380.0030.00913.73

preferences:
55.59 ms | 401 KiB | 5 Q