3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Converts numbers in string from western to eastern Arabic numerals. * * @param string $str Arbitrary text * @return string Text with western Arabic numerals converted into eastern Arabic numerals. */ function arabic_w2e($str) { $arabic_eastern = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'); $arabic_western = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); return str_replace($arabic_western, $arabic_eastern, $str); } /** * Converts numbers from eastern to western Arabic numerals. * * @param string $str Arbitrary text * @return string Text with eastern Arabic numerals converted into western Arabic numerals. */ function arabic_e2w($str) { $arabic_eastern = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'); $arabic_western = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); return str_replace($arabic_eastern, $arabic_western, $str); } //*/ Test echo arabic_w2e("1234567890"); // Outputs: ١٢٣٤٥٦٧٨٩٠ echo arabic_e2w("١٢٣٤٥٦٧٨٩٠"); // Outputs: 1234567890 //*/ ?>

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.0180.00016.58
8.3.60.0070.00718.55
8.3.50.0070.01121.90
8.3.40.0110.00418.90
8.3.30.0070.00719.09
8.3.20.0080.00020.34
8.3.10.0070.00021.71
8.3.00.0060.00425.33
8.2.180.0200.00325.92
8.2.170.0040.01222.96
8.2.160.0070.01120.52
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0050.00327.12
8.2.120.0080.00123.78
8.2.110.0080.00823.73
8.2.100.0040.00722.93
8.2.90.0060.00322.96
8.2.80.0040.00523.75
8.2.70.0060.00422.79
8.2.60.0040.00422.79
8.2.50.0060.00222.86
8.2.40.0040.00323.67
8.2.30.0010.00723.10
8.2.20.0050.00322.88
8.2.10.0020.00623.04
8.2.00.0060.00222.99
8.1.280.0180.00425.92
8.1.270.0040.00424.66
8.1.260.0030.00627.22
8.1.250.0020.00728.09
8.1.240.0080.00225.42
8.1.230.0050.00525.07
8.1.220.0020.00622.91
8.1.210.0060.00223.50
8.1.200.0040.00522.65
8.1.190.0010.00622.65
8.1.180.0060.00223.09
8.1.170.0020.00623.26
8.1.160.0030.00525.01
8.1.150.0040.00423.47
8.1.140.0060.00322.67
8.1.130.0000.00722.82
8.1.120.0060.00222.74
8.1.110.0040.00322.71
8.1.100.0060.00222.75
8.1.90.0040.00420.94
8.1.80.0030.00620.92
8.1.70.0050.00420.91
8.1.60.0060.00421.08
8.1.50.0060.00521.01
8.1.40.0070.00320.99
8.1.30.0030.00621.05
8.1.20.0050.00520.24
8.1.10.0070.00519.59
8.1.00.0080.00519.52
8.0.300.0060.00224.03
8.0.290.0030.00522.36
8.0.280.0050.00223.32
8.0.270.0020.00722.68
8.0.260.0050.00322.70
8.0.250.0060.00222.47
8.0.240.0040.00622.54
8.0.230.0020.00622.50
8.0.220.0060.00120.55
8.0.210.0040.00320.57
8.0.200.0020.00520.57
8.0.190.0020.00620.56
8.0.180.0030.00720.55
8.0.170.0040.00520.59
8.0.160.0070.00220.53
8.0.150.0100.00319.58
8.0.140.0060.00618.97
8.0.130.0100.00318.30
8.0.120.0110.00319.05
8.0.110.0100.00218.62
8.0.100.0080.00418.63
8.0.90.0100.00318.66
8.0.80.0080.00618.63
8.0.70.0100.00318.65
8.0.60.0080.00618.69
8.0.50.0080.00618.62
8.0.30.0100.00518.25
8.0.20.0110.00518.37
8.0.10.0110.00318.74
8.0.00.0060.00718.06
7.4.330.0090.00021.56
7.4.320.0080.00522.31
7.4.300.0080.00320.36
7.4.290.0060.00620.35
7.4.280.0090.00520.31
7.4.270.0100.00418.86
7.4.260.0090.00818.83
7.4.250.0130.00418.78
7.4.240.0090.00618.16
7.4.230.0120.00318.48
7.4.220.0090.00618.43
7.4.210.0100.00618.46
7.4.200.0090.00518.43
7.4.190.0130.00418.86
7.4.180.0120.00418.84
7.4.160.0090.00618.16
7.4.150.0120.00518.29
7.4.140.0120.00418.23
7.4.130.0110.00617.88
7.4.120.0120.00517.91
7.4.110.0120.00518.07
7.4.100.0100.00617.94
7.4.90.0130.00417.87
7.4.80.0090.00918.05
7.4.70.0090.00917.56
7.4.60.0110.00917.34
7.4.50.0120.00817.25
7.4.40.0150.00617.33
7.4.30.0130.00717.32
7.4.20.0140.00617.35
7.4.10.0120.00717.31
7.4.00.0090.00717.19
7.3.330.0120.00317.97
7.3.320.0130.00217.92
7.3.310.0110.00418.10
7.3.300.0120.00218.16
7.3.290.0090.00818.21
7.3.280.0140.00317.64
7.3.270.0120.00418.08
7.3.260.0100.00517.95
7.3.250.0110.00517.56
7.3.240.0120.00417.88
7.3.230.0120.00617.90
7.3.220.0130.00317.90
7.3.210.0100.00717.72
7.3.200.0140.00417.51
7.3.190.0100.00717.40
7.3.180.0130.00817.14
7.3.170.0140.00617.22
7.3.160.0150.00517.23
7.3.150.0140.00617.12
7.3.140.0110.00917.13
7.3.130.0110.00817.18
7.3.120.0130.00617.16
7.3.110.0120.00716.80
7.3.100.0120.00716.77
7.3.90.0120.00716.80
7.3.80.0100.00816.76
7.3.70.0110.00716.81
7.3.60.0100.00816.85
7.3.50.0110.00716.84
7.3.40.0120.00616.85
7.3.30.0100.00816.84
7.3.20.0140.00617.34
7.3.10.0120.00717.31
7.3.00.0130.00917.32
7.2.340.0120.00618.20
7.2.330.0120.00917.78
7.2.320.0150.00717.72
7.2.310.0150.00817.23
7.2.300.0150.00917.32
7.2.290.0130.01017.28
7.2.280.0140.00817.15
7.2.270.0140.00817.21
7.2.260.0130.00917.24
7.2.250.0120.01017.20
7.2.240.0130.00816.93
7.2.230.0120.00916.97
7.2.220.0130.00716.86
7.2.210.0130.00916.94
7.2.200.0120.00816.97
7.2.190.0110.00816.95
7.2.180.0130.00716.90
7.2.170.0140.00716.97
7.2.160.0120.00816.99
7.2.150.0140.00817.46
7.2.140.0130.00817.52
7.2.130.0120.00917.53
7.2.120.0140.00717.51
7.2.110.0170.00817.32
7.2.100.0170.00817.32
7.2.90.0170.00817.35
7.2.80.0220.00917.30
7.2.70.0190.00817.40
7.2.60.0170.00817.38
7.2.50.0190.00817.40
7.2.40.0260.00717.50
7.2.30.0210.00617.50
7.2.20.0210.00617.47
7.2.10.0210.00717.52
7.2.00.0180.00917.58
7.1.330.0140.00716.77
7.1.320.0160.00716.68
7.1.310.0130.00816.71
7.1.300.0130.00816.68
7.1.290.0120.00816.72
7.1.280.0140.00816.68
7.1.270.0150.00716.66
7.1.260.0130.00716.70
7.1.250.0130.00816.63
7.1.240.0160.00816.65
7.1.230.0170.00716.47
7.1.220.0200.00816.60
7.1.210.0190.00716.61
7.1.200.0160.00816.55
7.1.190.0190.00616.59
7.1.180.0200.00616.55
7.1.170.0200.00716.56
7.1.160.0200.00616.56
7.1.150.0170.00716.61
7.1.140.0180.00616.59
7.1.130.0170.00816.62
7.1.120.0170.00816.62
7.1.110.0200.00816.60
7.1.100.0170.00716.62
7.1.90.0190.00716.56
7.1.80.0200.00816.59
7.1.70.0180.00616.69
7.1.60.0190.00618.70
7.1.50.0190.00718.68
7.1.40.0190.00718.67
7.1.30.0210.00718.75
7.1.20.0200.00818.66
7.1.10.0170.00816.71
7.1.00.0150.00816.66
7.0.330.0140.00816.32
7.0.320.0150.00816.47
7.0.310.0210.00616.32
7.0.300.0220.00716.29
7.0.290.0200.00716.31
7.0.280.0210.00716.28
7.0.270.0210.00816.17
7.0.260.0210.00816.25
7.0.250.0200.00816.27
7.0.240.0190.00816.38
7.0.230.0190.00816.34
7.0.220.0190.00716.31
7.0.210.0190.00716.35
7.0.200.0170.00716.48
7.0.190.0190.00716.47
7.0.180.0170.00816.44
7.0.170.0190.00716.44
7.0.160.0180.00716.46
7.0.150.0190.00816.33
7.0.140.0150.00816.39
7.0.130.0200.00716.37
7.0.120.0190.00616.32
7.0.110.0130.00816.34
7.0.100.0180.00716.31
7.0.90.0170.00916.29
7.0.80.0180.00616.27
7.0.70.0190.00816.32
7.0.60.0200.00716.29
7.0.50.0220.00516.32
7.0.40.0170.00716.29
7.0.30.0150.00816.34
7.0.20.0180.00716.22
7.0.10.0210.00716.36
7.0.00.0170.00616.31
5.6.400.0130.01016.35
5.6.390.0160.00716.38
5.6.380.0150.00816.31
5.6.370.0150.00716.30
5.6.360.0150.00816.26
5.6.350.0150.00816.24
5.6.340.0150.00816.31
5.6.330.0150.00916.31
5.6.320.0140.00816.21
5.6.310.0140.00816.21
5.6.300.0130.01316.75
5.6.290.0120.01416.75
5.6.280.0120.01416.81
5.6.270.0160.01116.77
5.6.260.0140.01316.76
5.6.250.0140.01416.80
5.6.240.0130.01616.76
5.6.230.0150.01216.80
5.6.220.0120.01616.73
5.6.210.0150.01316.76
5.6.200.0140.01516.81
5.6.190.0150.01216.82
5.6.180.0140.01316.79
5.6.170.0130.01716.81
5.6.160.0140.01316.83
5.6.150.0140.01416.80
5.6.140.0140.01316.83
5.6.130.0160.01116.81
5.6.120.0130.01316.83
5.6.110.0150.01416.74
5.6.100.0140.01416.84
5.6.90.0150.01516.75
5.6.80.0130.01316.63
5.6.70.0150.01216.73
5.6.60.0130.01616.68
5.6.50.0140.01316.62
5.6.40.0140.01316.66
5.6.30.0120.01516.64
5.6.20.0130.01316.63
5.6.10.0140.01316.63
5.6.00.0150.01316.62
5.5.380.0150.01116.32
5.5.370.0140.01216.30
5.5.360.0150.01216.24
5.5.350.0120.01416.27
5.5.340.0170.01216.30
5.5.330.0170.01016.32
5.5.320.0150.01416.30
5.5.310.0150.01216.28
5.5.300.0140.01216.31
5.5.290.0150.01416.28
5.5.280.0130.01416.28
5.5.270.0140.01316.28
5.5.260.0140.01616.31
5.5.250.0150.01316.28
5.5.240.0130.01416.21
5.5.230.0140.01216.22
5.5.220.0150.01216.18
5.5.210.0140.01216.22
5.5.200.0130.01216.22
5.5.190.0130.01316.13
5.5.180.0130.01416.12
5.5.170.0140.00916.13
5.5.160.0130.01216.17
5.5.150.0110.01416.15
5.5.140.0130.01216.14
5.5.130.0130.01316.11
5.5.120.0150.01116.14
5.5.110.0130.01316.11
5.5.100.0130.01416.27
5.5.90.0130.01116.21
5.5.80.0130.01216.16
5.5.70.0130.01216.26
5.5.60.0130.01216.19
5.5.50.0130.01216.20
5.5.40.0130.01216.21
5.5.30.0130.01216.23
5.5.20.0110.01416.15
5.5.10.0130.01316.13
5.5.00.0150.01116.21
5.4.450.0110.01114.15
5.4.440.0100.01214.19
5.4.430.0110.01414.17
5.4.420.0130.01114.18
5.4.410.0110.01114.14
5.4.400.0110.01214.05
5.4.390.0110.01014.11
5.4.380.0110.01114.07
5.4.370.0130.01014.08
5.4.360.0110.01114.09
5.4.350.0100.01114.11
5.4.340.0110.01214.07
5.4.330.0100.00813.54
5.4.320.0120.01014.08
5.4.310.0110.01114.08
5.4.300.0120.01114.10
5.4.290.0110.01214.10
5.4.280.0110.01014.10
5.4.270.0100.01114.12
5.4.260.0110.01014.07
5.4.250.0120.00914.09
5.4.240.0120.00914.12
5.4.230.0090.01114.11
5.4.220.0110.01014.04
5.4.210.0110.01114.00
5.4.200.0110.01014.07
5.4.190.0090.01214.08
5.4.180.0100.01214.08
5.4.170.0110.01114.06
5.4.160.0110.01014.04
5.4.150.0110.01114.07
5.4.140.0100.01213.92
5.4.130.0100.01113.97
5.4.120.0090.01313.96
5.4.110.0110.01113.97
5.4.100.0110.01113.98
5.4.90.0110.01013.93
5.4.80.0110.01114.02
5.4.70.0110.01114.00
5.4.60.0100.01113.97
5.4.50.0100.01113.98
5.4.40.0120.00914.00
5.4.30.0120.00914.00
5.4.20.0110.01014.04
5.4.10.0130.00913.94
5.4.00.0110.01013.93

preferences:
47.82 ms | 401 KiB | 5 Q