3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverseHebrew($text) { $words = array_reverse(explode(' ', $text)); foreach ($words as $index => $word) { if (isHebrew($word)) { $words[$index] = mbStrRev($word); } } return join(' ', $words); } function isHebrew($text) { for ($i = 0, $cnt = strlen($text); $i < $cnt; ++$i) { if (ord($text[$i]) > 127) { return true; } } return false; } function mbStrRev($string, $encoding = null) { if ($encoding === null) { $encoding = mb_detect_encoding($string); } $length = mb_strlen($string, $encoding); $reversed = ''; while ($length-- > 0) { $reversed .= mb_substr($string, $length, 1, $encoding); } return $reversed; } $name = "אַבְרָהָם"; $newName = "Alexander Manukian"; echo reverseHebrew($newName);

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.70.0140.00716.58
8.3.60.0070.01018.09
8.3.50.0150.00018.04
8.3.40.0140.00718.79
8.3.30.0060.01018.67
8.3.20.0000.00819.21
8.3.10.0080.00021.78
8.3.00.0070.00020.68
8.2.180.0070.01418.41
8.2.170.0070.00722.96
8.2.160.0100.00322.12
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00418.16
8.2.120.0000.00826.35
8.2.110.0070.00419.45
8.2.100.0090.00317.91
8.2.90.0080.00017.62
8.2.80.0050.00317.97
8.2.70.0050.00317.93
8.2.60.0000.00818.16
8.2.50.0000.00818.10
8.2.40.0070.00019.48
8.2.30.0040.00419.23
8.2.20.0000.00818.07
8.2.10.0000.00818.17
8.2.00.0050.00317.63
8.1.280.0130.00325.92
8.1.270.0090.00020.83
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0000.01022.13
8.1.230.0110.00022.13
8.1.220.0080.00017.79
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0060.00317.22
8.1.180.0080.00018.10
8.1.170.0090.00018.64
8.1.160.0040.00418.95
8.1.150.0070.00018.82
8.1.140.0000.00822.03
8.1.130.0000.00720.26
8.1.120.0000.00717.30
8.1.110.0080.00017.37
8.1.100.0060.00317.52
8.1.90.0040.00417.49
8.1.80.0060.00617.39
8.1.70.0000.00717.49
8.1.60.0000.00817.61
8.1.50.0040.00417.47
8.1.40.0040.00417.57
8.1.30.0060.00317.55
8.1.20.0000.00717.66
8.1.10.0000.00817.50
8.1.00.0040.00417.55
8.0.300.0070.00018.77
8.0.290.0050.00316.75
8.0.280.0000.00718.42
8.0.270.0070.00017.16
8.0.260.0070.00018.45
8.0.250.0040.00416.98
8.0.240.0000.00716.99
8.0.230.0000.00716.91
8.0.220.0030.00716.89
8.0.210.0000.00716.89
8.0.200.0030.00316.89
8.0.190.0040.00416.92
8.0.180.0000.00716.83
8.0.170.0030.00616.90
8.0.160.0080.00016.77
8.0.150.0040.00416.85
8.0.140.0000.00816.77
8.0.130.0050.00013.34
8.0.120.0060.00316.73
8.0.110.0040.00416.77
8.0.100.0000.00716.77
8.0.90.0070.00016.71
8.0.80.0020.01316.91
8.0.70.0000.00716.88
8.0.60.0070.00016.88
8.0.50.0000.00716.77
8.0.30.0060.01017.00
8.0.20.0110.01117.40
8.0.10.0030.00517.07
8.0.00.0100.01216.88
7.4.330.0030.00315.55
7.4.320.0060.00016.60
7.4.300.0000.00616.64
7.4.290.0070.00016.52
7.4.280.0080.00316.50
7.4.270.0000.00716.45
7.4.260.0000.00816.50
7.4.250.0030.00316.50
7.4.240.0050.00316.40
7.4.230.0000.00816.59
7.4.220.0000.00816.57
7.4.210.0080.00716.54
7.4.200.0080.00016.39
7.4.160.0120.00516.58
7.4.140.0130.00717.86
7.4.130.0150.00416.45
7.4.120.0070.01216.60
7.4.110.0180.00616.63
7.4.100.0060.01116.48
7.4.90.0130.01016.44
7.4.80.0060.01319.39
7.4.70.0040.01416.59
7.4.60.0090.00616.33
7.4.50.0100.00316.44
7.4.40.0100.00616.44
7.4.00.0100.00715.10
7.3.330.0030.00313.15
7.3.320.0000.00613.40
7.3.310.0000.00816.30
7.3.300.0000.00616.44
7.3.290.0030.00316.25
7.3.280.0060.00916.36
7.3.260.0090.00916.57
7.3.240.0070.01116.47
7.3.230.0090.00816.40
7.3.210.0110.00616.59
7.3.200.0100.00716.37
7.3.190.0030.01616.46
7.3.180.0060.01316.38
7.3.170.0090.01216.28
7.3.160.0080.01216.34
7.3.120.0100.00915.01
7.3.110.0100.00815.00
7.3.100.0060.01114.84
7.3.90.0050.01014.77
7.3.80.0070.00714.96
7.3.70.0060.00614.76
7.3.60.0030.00814.87
7.3.50.0050.00814.81
7.3.40.0120.00314.77
7.3.30.0050.01014.67
7.3.20.0080.00616.77
7.3.10.0110.00616.47
7.3.00.0080.00616.46
7.2.330.0090.01016.49
7.2.320.0100.00716.52
7.2.310.0180.01516.86
7.2.300.0130.00316.79
7.2.290.0080.00916.50
7.2.250.0130.00515.17
7.2.240.0040.01414.91
7.2.230.0080.00715.06
7.2.220.0080.00915.07
7.2.210.0020.01315.08
7.2.200.0050.00815.13
7.2.190.0050.01214.93
7.2.180.0090.00715.03
7.2.170.0050.00914.97
7.2.160.0070.00715.12
7.2.150.0000.01016.93
7.2.140.0030.01017.10
7.2.130.0060.01216.73
7.2.120.0130.00216.74
7.2.110.0290.00915.96
7.2.100.0250.00815.99
7.2.90.0340.01016.24
7.2.80.0240.00716.12
7.2.70.0260.00616.09
7.2.60.0090.00816.08
7.2.50.0110.00416.22
7.2.40.0070.01116.20
7.2.30.0160.00916.03
7.2.20.0080.00715.95
7.2.10.0390.00516.00
7.2.00.0200.01016.33
7.1.330.0080.00715.89
7.1.320.0060.00615.82
7.1.310.0100.00315.76
7.1.300.0070.00715.67
7.1.290.0100.00415.77
7.1.280.0030.01015.70
7.1.270.0060.00615.82
7.1.260.0060.00515.94
7.1.250.0110.00715.61
7.1.240.0100.00015.60
7.1.230.0290.00714.59
7.1.220.0360.00314.80
7.1.210.0350.00714.85
7.1.200.0470.00214.94
7.1.190.0380.00614.95
7.1.180.0090.00614.96
7.1.170.0290.00514.87
7.1.160.0060.01014.86
7.1.150.0440.00514.93
7.1.140.0080.00614.67
7.1.130.0080.00714.62
7.1.120.0070.00714.69
7.1.110.0100.00514.73
7.1.100.0320.00914.81
7.1.90.0270.00714.64
7.1.80.0090.00714.70
7.1.70.0490.00614.68
7.1.60.0150.00423.71
7.1.50.0190.00523.61
7.1.40.0110.00923.77
7.1.30.0550.00523.74
7.1.20.0170.00523.86
7.1.10.0430.00414.64
7.1.00.0050.00914.88
7.0.330.0000.01015.48
7.0.320.0000.01315.53
7.0.310.0070.00715.54
7.0.300.0030.00715.55
7.0.290.0000.01015.55
7.0.280.0080.00015.55
7.0.270.0060.00615.38
7.0.260.0040.00715.11
7.0.250.0000.00815.61
7.0.240.0030.01015.35
7.0.230.0040.01115.61
7.0.220.0000.01115.34
7.0.210.0100.00615.14
7.0.200.0030.01015.59
7.0.190.0060.00615.59
7.0.180.0080.00315.57
7.0.170.0030.00615.59
7.0.160.0030.00915.44
7.0.150.0080.00815.42
7.0.140.0030.01015.45
7.0.130.0040.00715.18
7.0.120.0130.00015.32
7.0.110.0030.01315.50
7.0.100.0100.00715.44
7.0.90.0060.00315.27
7.0.80.0120.00315.17
7.0.70.0000.01515.47
7.0.60.0100.00315.53
7.0.50.0110.00015.48
7.0.40.0050.00313.53
7.0.30.0040.00813.26
7.0.20.0070.00313.42
7.0.10.0030.00813.48
7.0.00.0000.01413.61
5.6.400.0070.00714.38
5.6.390.0070.00714.69
5.6.380.0040.00714.41
5.6.370.0060.00914.10
5.6.360.0000.01414.29
5.6.350.0040.00714.17
5.6.340.0070.00714.07
5.6.330.0070.00714.59
5.6.320.0070.01014.63
5.6.310.0070.00414.06
5.6.300.0090.00314.25
5.6.290.0070.01014.21
5.6.280.0000.01414.62
5.6.270.0030.01314.20
5.6.260.0090.00914.67
5.6.250.0090.00314.40
5.6.240.0030.01014.49
5.6.230.0030.01014.18
5.6.220.0060.00614.32
5.6.210.0000.01014.17
5.6.200.0070.00714.51
5.6.190.0110.00014.47
5.6.180.0030.00914.50
5.6.170.0030.00614.46
5.6.160.0110.00314.47
5.6.150.0030.00914.34
5.6.140.0000.01114.60
5.6.130.0030.01014.59
5.6.120.0040.01214.66
5.6.110.0040.00414.29
5.6.100.0060.00614.84
5.6.90.0100.00314.47
5.6.80.0000.00814.39
5.6.70.0030.01414.21
5.6.60.0070.01014.20
5.6.50.0130.00314.50
5.6.40.0060.00914.42
5.6.30.0030.00914.55
5.6.20.0100.00714.55
5.6.10.0060.00314.11
5.6.00.0000.01214.35

preferences:
51.88 ms | 401 KiB | 5 Q