3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * By Darien Hager, Jan 2007... Use however you wish, but please * please give credit in source comments. * * Change "UTF-8" to whichever encoding you are expecting to use. */ function ords_to_unistr($ords, $encoding = 'UTF-8') { // Turns an array of ordinal values into a string of unicode characters $str = ''; for ($i = 0; $i < count($ords); $i++) { // Pack this number into a 4-byte string // (Or multiple one-byte strings, depending on context.) $v = $ords[$i]; $str .= pack("N",$v); } $str = mb_convert_encoding($str,$encoding,"UCS-4BE"); return($str); } function unistr_to_ords($str, $encoding = 'UTF-8') { // Turns a string of unicode characters into an array of ordinal values, // Even if some of those characters are multibyte. $str = mb_convert_encoding($str,"UCS-4BE",$encoding); $ords = array(); // Visit each unicode character for ($i = 0; $i < mb_strlen($str,"UCS-4BE"); $i++) { // Now we have 4 bytes. Find their total // numeric value. $s2 = mb_substr($str,$i,1,"UCS-4BE"); $val = unpack("N",$s2); $ords[] = $val[1]; } return($ords); } function alphabet($firstCharacter = 'A', $lastCharacter = 'Z') { $firstCharacterValue = unistr_to_ords($firstCharacter)[0]; $lastCharacterValue = unistr_to_ords($lastCharacter)[0]; if ($firstCharacterValue < $lastCharacterValue) { for ($character = $firstCharacterValue; $character <= $lastCharacterValue; ++$character) { yield ords_to_unistr(array($character)); }; } else { for ($character = $firstCharacterValue; $character >= $lastCharacterValue; --$character) { yield ords_to_unistr(array($character)); }; } } foreach (alphabet('ا', 'ی') as $letter) { echo $letter, PHP_EOL; }

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.5.10.0090.00920.02
8.5.00.0130.00920.05
8.4.150.0030.00014.05
8.4.140.0100.01117.55
8.4.130.0080.00117.73
8.4.120.0050.01020.59
8.4.110.0090.01222.26
8.4.100.0140.00717.95
8.4.90.0110.01017.55
8.4.80.0050.00419.69
8.4.70.0100.01117.88
8.4.60.0100.01218.05
8.4.50.0110.01018.60
8.4.40.0160.00019.37
8.4.30.0100.01017.80
8.4.20.0030.01917.91
8.4.10.0110.01117.54
8.3.280.0110.00918.42
8.3.270.0080.01216.64
8.3.260.0130.00716.54
8.3.250.0110.00818.84
8.3.240.0050.00316.76
8.3.230.0120.00816.74
8.3.220.0110.00816.46
8.3.210.0110.00816.55
8.3.200.0140.00616.52
8.3.190.0080.00217.26
8.3.180.0120.00818.85
8.3.170.0130.00717.18
8.3.160.0110.00716.64
8.3.150.0100.01018.86
8.3.140.0150.00416.59
8.3.130.0080.00018.51
8.3.120.0110.00720.69
8.3.110.0000.01616.79
8.3.100.0080.00016.61
8.3.90.0100.00026.77
8.3.80.0060.00317.97
8.3.70.0160.00616.63
8.3.60.0110.01116.50
8.3.50.0090.00921.15
8.3.40.0090.00618.75
8.3.30.0120.00318.39
8.3.20.0090.00018.95
8.3.10.0030.00621.36
8.3.00.0080.00019.05
8.2.290.0120.00820.48
8.2.280.0130.00616.73
8.2.270.0080.01116.53
8.2.260.0040.01118.70
8.2.250.0110.00916.50
8.2.240.0060.00318.93
8.2.230.0030.00620.94
8.2.220.0040.00424.06
8.2.210.0080.00026.77
8.2.200.0110.00018.29
8.2.190.0060.00918.21
8.2.180.0140.01018.13
8.2.170.0160.00322.96
8.2.160.0070.00719.30
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00420.98
8.2.110.0100.00019.24
8.2.100.0060.00617.91
8.2.90.0050.00519.30
8.2.80.0000.00917.97
8.2.70.0030.00617.75
8.2.60.0070.00317.80
8.2.50.0030.00618.10
8.2.40.0050.00320.59
8.2.30.0040.00420.55
8.2.20.0000.00817.81
8.2.10.0060.00318.20
8.2.00.0000.00718.07
8.1.330.0140.00422.02
8.1.320.0090.01016.14
8.1.310.0000.00818.43
8.1.300.0040.01817.98
8.1.290.0050.00518.88
8.1.280.0090.00625.92
8.1.270.0050.00323.86
8.1.260.0090.00026.35
8.1.250.0030.00528.09
8.1.240.0070.00319.28
8.1.230.0080.00419.67
8.1.220.0030.00917.88
8.1.210.0080.00018.77
8.1.200.0030.00617.47
8.1.190.0050.00317.35
8.1.180.0030.00518.10
8.1.170.0000.00818.69
8.1.160.0040.00419.07
8.1.150.0040.00418.97
8.1.140.0050.00519.65
8.1.130.0000.00717.78
8.1.120.0000.00817.39
8.1.110.0040.00417.50
8.1.100.0050.00317.57
8.1.90.0000.00917.48
8.1.80.0030.00617.43
8.1.70.0000.00817.41
8.1.60.0020.00517.60
8.1.50.0000.00917.58
8.1.40.0040.00417.48
8.1.30.0040.00417.70
8.1.20.0040.00417.74
8.1.10.0080.00017.47
8.1.00.0080.00017.55
8.0.300.0090.00719.39
8.0.290.0040.00416.75
8.0.280.0050.00218.53
8.0.270.0040.00417.21
8.0.260.0030.00318.88
8.0.250.0070.00017.02
8.0.240.0050.00316.93
8.0.230.0070.00016.89
8.0.220.0050.00316.98
8.0.210.0000.00717.01
8.0.200.0030.00317.02
8.0.190.0040.00417.04
8.0.180.0060.00317.04
8.0.170.0000.00817.04
8.0.160.0000.00717.02
8.0.150.0000.00716.95
8.0.140.0000.00716.97
8.0.130.0060.00013.39
8.0.120.0000.00816.90
8.0.110.0090.00016.90
8.0.100.0030.00616.84
8.0.90.0050.00216.96
8.0.80.0060.01216.93
8.0.70.0040.00416.97
8.0.60.0040.00416.82
8.0.50.0040.00416.95
8.0.30.0140.00717.13
8.0.20.0120.01117.37
8.0.10.0100.01017.24
8.0.00.0100.01016.95
7.4.330.0050.00015.08
7.4.320.0030.00516.68
7.4.300.0070.00016.58
7.4.290.0070.00016.59
7.4.280.0030.00916.67
7.4.270.0050.00316.50
7.4.260.0040.00416.55
7.4.250.0070.00016.47
7.4.240.0070.00016.51
7.4.230.0000.00716.68
7.4.220.0160.01216.72
7.4.210.0090.00616.76
7.4.200.0070.00016.43
7.4.150.0110.01317.03
7.4.140.0120.00817.34
7.4.130.0120.00916.62
7.4.120.0120.01216.59
7.4.110.0130.01216.46
7.4.100.0140.01116.50
7.4.90.0130.00716.57
7.4.80.0100.01317.97
7.4.70.0100.01616.57
7.4.60.0190.00616.61
7.4.50.0090.00916.59
7.4.40.0090.01016.62
7.4.30.0070.01316.48
7.4.20.0200.01016.45
7.4.10.0130.00715.62
7.4.00.0050.01215.44
7.3.330.0030.00313.37
7.3.320.0000.00613.37
7.3.310.0030.00516.45
7.3.300.0000.00716.37
7.3.290.0060.01416.44
7.3.280.0090.00816.43
7.3.270.0120.01116.91
7.3.260.0140.00916.47
7.3.250.0150.00816.54
7.3.240.0150.01016.56
7.3.230.0110.01016.37
7.3.220.0100.01016.76
7.3.210.0110.01016.48
7.3.200.0160.01016.60
7.3.190.0060.01416.32
7.3.180.0110.00816.45
7.3.170.0130.00816.54
7.3.160.0120.00816.45
7.3.150.0100.01316.33
7.3.140.0090.00916.47
7.3.130.0090.01115.61
7.3.120.0090.01215.54
7.3.110.0090.01215.62
7.3.100.0110.01115.43
7.3.90.0150.00815.71
7.3.80.0180.00515.55
7.3.70.0100.01015.22
7.3.60.0110.00915.36
7.3.50.0130.00915.33
7.3.40.0140.00715.32
7.3.30.0110.00815.42
7.3.20.0120.01015.32
7.3.10.0150.00915.72
7.3.00.0110.00815.65
7.2.340.0150.00816.81
7.2.330.0170.00716.62
7.2.320.0170.01116.84
7.2.310.0160.00916.61
7.2.300.0090.01216.80
7.2.290.0100.01716.77
7.2.280.0170.00316.62
7.2.270.0150.00616.74
7.2.260.0150.00615.85
7.2.250.0170.00715.81
7.2.240.0100.01115.87
7.2.230.0120.01015.80
7.2.220.0120.01215.84
7.2.210.0120.01015.85
7.2.200.0120.00715.70
7.2.190.0140.00415.50
7.2.180.0090.01315.63
7.2.170.0110.00815.54
7.2.160.0090.01515.62
7.2.150.0190.00715.60
7.2.140.0140.00715.56
7.2.130.0160.01115.99
7.2.120.0110.01016.02
7.2.110.0070.01515.99
7.2.100.0180.01015.84
7.2.90.0320.00815.91
7.2.80.0120.01116.00
7.2.70.0080.01415.98
7.2.60.0080.01116.16
7.2.50.0140.00716.01
7.2.40.0120.01215.96
7.2.30.0100.01016.04
7.2.20.0170.00815.85
7.2.10.0150.00915.96
7.2.00.0110.00915.93
7.1.330.0090.00914.68
7.1.320.0130.00814.98
7.1.310.0110.00914.69
7.1.300.0110.01014.66
7.1.290.0130.00814.34
7.1.280.0160.00414.49
7.1.270.0110.00814.58
7.1.260.0270.01214.47
7.1.250.0080.01114.81
7.1.240.0150.01014.42
7.1.230.0140.00814.54
7.1.220.0150.01214.49
7.1.210.0100.01014.44
7.1.200.0130.00914.66
7.1.190.0100.01114.32
7.1.180.0080.01314.49
7.1.170.0310.00614.42
7.1.160.0120.01114.41
7.1.150.0110.00914.44
7.1.140.0140.01014.39
7.1.130.0120.01014.36
7.1.120.0180.01014.44
7.1.110.0140.00814.54
7.1.100.0130.00814.39
7.1.90.0140.00814.53
7.1.80.0200.00814.51
7.1.70.0120.01015.14
7.1.60.0100.01116.05
7.1.50.0100.01214.44
7.1.40.0140.00914.50
7.1.30.0170.00714.56
7.1.20.0100.01314.51
7.1.10.0100.01114.52
7.1.00.0090.02716.43
7.0.330.0180.00714.09
7.0.320.0150.01414.20
7.0.310.0180.00514.02
7.0.300.0180.01114.09
7.0.290.0170.00914.17
7.0.280.0180.01014.14
7.0.270.0190.01114.21
7.0.260.0150.01114.12
7.0.250.0210.00714.19
7.0.240.0160.01114.20
7.0.230.0150.00814.23
7.0.220.0640.01114.24
7.0.210.0210.00614.15
7.0.200.0120.01114.74
7.0.190.0220.00414.14
7.0.180.0160.00914.18
7.0.170.0180.01014.25
7.0.160.0180.00814.17
7.0.150.0230.01014.11
7.0.140.0150.01214.27
7.0.130.0150.00914.23
7.0.120.0140.01214.19
7.0.110.0180.00714.24
7.0.100.0280.01214.29
7.0.90.0170.00614.22
7.0.80.0130.02815.62
7.0.70.0140.03115.58
7.0.60.0170.01715.56
7.0.50.0210.02815.77
7.0.40.0160.02315.68
7.0.30.0180.02815.66
7.0.20.0120.02915.71
7.0.10.0180.02515.71
7.0.00.0180.02315.63
5.6.400.0140.01514.85
5.6.390.0140.01315.25
5.6.380.0120.01414.99
5.6.370.0150.01114.97
5.6.360.0190.01114.92
5.6.350.0150.01014.95
5.6.340.0140.01415.09
5.6.330.0180.01015.16
5.6.320.0140.01114.97
5.6.310.0150.01215.10
5.6.300.0160.00814.99
5.6.290.0140.01115.03
5.6.280.0110.02716.50
5.6.270.0170.00915.02
5.6.260.0140.01115.11
5.6.250.0160.00814.98
5.6.240.0200.00914.92
5.6.230.0150.02216.31
5.6.220.0180.02316.41
5.6.210.0110.03016.43
5.6.200.0130.02816.53
5.6.190.0160.01816.52
5.6.180.0140.01816.53
5.6.170.0200.02516.58
5.6.160.0130.03116.40
5.6.150.0110.03216.61
5.6.140.0160.02916.47
5.6.130.0130.02716.48
5.6.120.0180.01716.55
5.6.110.0150.01816.59
5.6.100.0160.01816.52
5.6.90.0140.02116.37
5.6.80.0140.02416.32
5.6.70.0130.01816.36
5.6.60.0130.01716.24
5.6.50.0150.02216.28
5.6.40.0130.01616.26
5.6.30.0120.02716.29
5.6.20.0150.01816.24
5.6.10.0080.02216.27
5.6.00.0160.02216.33
5.5.380.0220.01214.96
5.5.370.0160.02716.36
5.5.360.0160.02116.30
5.5.350.0160.02616.39
5.5.340.0170.01616.46
5.5.330.0160.03116.57
5.5.320.0160.03116.32
5.5.310.0200.01916.44
5.5.300.0210.02516.42
5.5.290.0120.03016.37
5.5.280.0170.02716.41
5.5.270.0150.02116.34
5.5.260.0160.02216.43
5.5.250.0110.02016.25
5.5.240.0180.01516.17
5.5.230.0150.01916.19
5.5.220.0110.02016.27
5.5.210.0150.01716.15
5.5.200.0140.01916.27
5.5.190.0170.01616.22
5.5.180.0130.02416.29
5.5.170.0170.01214.87
5.5.160.0150.01616.23
5.5.150.0130.01916.19
5.5.140.0140.01916.07
5.5.130.0120.01716.23
5.5.120.0120.02816.19
5.5.110.0160.02516.23
5.5.100.0130.01916.16
5.5.90.0130.01816.15
5.5.80.0170.02416.04
5.5.70.0130.02016.20
5.5.60.0140.01916.22
5.5.50.0160.01816.22
5.5.40.0150.01516.18
5.5.30.0170.01416.22
5.5.20.0150.02016.22
5.5.10.0100.01816.06
5.5.00.0160.01416.14

preferences:
175.33 ms | 403 KiB | 5 Q