3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json_data = array ('id'=>1,'name'=>"фыфыывфы",'country'=>'Russia'); function json_encode_cyr($str) { $arr_replace_utf = array('\u0410', '\u0430','\u0411','\u0431','\u0412','\u0432', '\u0413','\u0433','\u0414','\u0434','\u0415','\u0435','\u0401','\u0451','\u0416', '\u0436','\u0417','\u0437','\u0418','\u0438','\u0419','\u0439','\u041a','\u043a', '\u041b','\u043b','\u041c','\u043c','\u041d','\u043d','\u041e','\u043e','\u041f', '\u043f','\u0420','\u0440','\u0421','\u0441','\u0422','\u0442','\u0423','\u0443', '\u0424','\u0444','\u0425','\u0445','\u0426','\u0446','\u0427','\u0447','\u0428', '\u0448','\u0429','\u0449','\u042a','\u044a','\u042b','\u044b','\u042c','\u044c', '\u042d','\u044d','\u042e','\u044e','\u042f','\u044f'); $arr_replace_cyr = array('А', 'а', 'Б', 'б', 'В', 'в', 'Г', 'г', 'Д', 'д', 'Е', 'е', 'Ё', 'ё', 'Ж','ж','З','з','И','и','Й','й','К','к','Л','л','М','м','Н','н','О','о', 'П','п','Р','р','С','с','Т','т','У','у','Ф','ф','Х','х','Ц','ц','Ч','ч','Ш','ш', 'Щ','щ','Ъ','ъ','Ы','ы','Ь','ь','Э','э','Ю','ю','Я','я'); $str1 = json_encode($str); $str2 = str_replace($arr_replace_utf,$arr_replace_cyr,$str1); return $str2; } echo json_encode($json_data);?> <br /> <?php $json = json_encode_cyr($json_data); echo json_encode($json); ?><br /> <?php echo json_encode($json_data, JSON_UNESCAPED_UNICODE); ?>

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.0080.00818.43
8.3.50.0150.00321.27
8.3.40.0080.00818.87
8.3.30.0070.01118.77
8.3.20.0050.00318.69
8.3.10.0080.00020.36
8.3.00.0030.00717.50
8.2.180.0110.00416.50
8.2.170.0070.00722.96
8.2.160.0060.00918.68
8.2.150.0030.00724.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00419.77
8.2.110.0030.00722.11
8.2.100.0110.00017.91
8.2.90.0030.00619.21
8.2.80.0000.00817.97
8.2.70.0050.00317.50
8.2.60.0040.00418.04
8.2.50.0060.00318.07
8.2.40.0040.00418.34
8.2.30.0000.00719.72
8.2.20.0040.00417.61
8.2.10.0000.00817.77
8.2.00.0030.00517.70
8.1.280.0110.00425.92
8.1.270.0070.00023.99
8.1.260.0080.00026.35
8.1.250.0000.00928.09
8.1.240.0030.00620.32
8.1.230.0030.00820.88
8.1.220.0080.00018.77
8.1.210.0000.00818.88
8.1.200.0030.00617.23
8.1.190.0040.00417.39
8.1.180.0040.00418.10
8.1.170.0000.00818.76
8.1.160.0000.00718.86
8.1.150.0080.00018.54
8.1.140.0000.00817.35
8.1.130.0000.00717.86
8.1.120.0000.00717.40
8.1.110.0000.00717.42
8.1.100.0070.00017.47
8.1.90.0000.00717.34
8.1.80.0030.00317.33
8.1.70.0000.00717.41
8.1.60.0050.00317.62
8.1.50.0000.00817.45
8.1.40.0040.00417.58
8.1.30.0000.00817.57
8.1.20.0030.00517.52
8.1.10.0000.00717.58
8.1.00.0000.00817.52
8.0.300.0000.00719.93
8.0.290.0030.00616.75
8.0.280.0070.00018.38
8.0.270.0030.00317.20
8.0.260.0000.00718.55
8.0.250.0040.00416.97
8.0.240.0060.00316.99
8.0.230.0030.00316.79
8.0.220.0030.00616.85
8.0.210.0040.00416.86
8.0.200.0000.00616.92
8.0.190.0080.00016.98
8.0.180.0070.00016.93
8.0.170.0080.00016.83
8.0.160.0070.00016.82
8.0.150.0080.00016.79
8.0.140.0140.00016.84
8.0.130.0000.00513.32
8.0.120.0000.00716.80
8.0.110.0000.00716.90
8.0.100.0040.00416.80
8.0.90.0040.00416.86
8.0.80.0040.01216.76
8.0.70.0040.00416.82
8.0.60.0000.00816.66
8.0.50.0000.00716.80
8.0.30.0090.01017.12
8.0.20.0140.00617.40
8.0.10.0030.00516.93
8.0.00.0080.01416.78
7.4.330.0000.00514.77
7.4.320.0060.00016.48
7.4.300.0050.00216.54
7.4.290.0000.00916.52
7.4.280.0040.00416.68
7.4.270.0030.00316.67
7.4.260.0030.00313.23
7.4.250.0080.00016.38
7.4.240.0000.00816.53
7.4.230.0030.00316.73
7.4.220.0180.00016.56
7.4.210.0090.01016.55
7.4.200.0060.00316.53
7.4.190.0030.00316.43
7.4.160.0150.00616.69
7.4.150.0040.01417.40
7.4.140.0060.01117.24
7.4.130.0080.01216.59
7.4.120.0070.01316.58
7.4.110.0040.01816.39
7.4.100.0110.00716.51
7.4.90.0130.01016.48
7.4.80.0120.00619.03
7.4.70.0120.00416.40
7.4.60.0090.00916.58
7.4.50.0000.00516.61
7.4.40.0120.00422.27
7.4.30.0100.00716.46
7.4.00.0000.01814.91
7.3.330.0040.00313.26
7.3.320.0000.00513.09
7.3.310.0000.00716.25
7.3.300.0030.00316.27
7.3.290.0110.00316.27
7.3.280.0100.00916.21
7.3.270.0120.00617.40
7.3.260.0080.01318.24
7.3.250.0090.00916.39
7.3.240.0080.00816.60
7.3.230.0080.00916.39
7.3.210.0070.01116.39
7.3.200.0040.01619.39
7.3.190.0150.00516.46
7.3.180.0040.01116.52
7.3.170.0200.00316.38
7.3.160.0060.00916.37
7.3.120.0060.00914.75
7.2.330.0040.01416.54
7.2.320.0080.00816.83
7.2.310.0100.01416.51
7.2.300.0070.01016.77
7.2.290.0080.00816.31
7.2.00.0030.01019.48
7.1.100.0070.00418.30
7.1.70.0110.00417.17
7.1.60.0110.01419.40
7.1.50.0090.01316.79
7.1.00.0000.06322.45
7.0.200.0070.00714.97
7.0.140.0170.06022.00
7.0.90.0100.06719.89
7.0.80.0070.07019.98
7.0.70.0170.07019.91
7.0.60.0070.05319.93
7.0.50.0100.04020.38
7.0.40.0130.04320.13
7.0.30.0000.04720.17
7.0.20.0070.05320.08
7.0.10.0070.04020.04
7.0.00.0000.06320.07
5.6.280.0030.07321.14
5.6.240.0030.09320.59
5.6.230.0070.07020.58
5.6.220.0130.08020.54
5.6.210.0030.04320.57
5.6.200.0070.04321.19
5.6.190.0030.04721.13
5.6.180.0070.04321.11
5.6.170.0030.04021.01
5.6.160.0130.03021.12
5.6.150.0030.04020.99
5.6.140.0100.04021.18
5.6.130.0030.04321.09
5.6.120.0000.04721.09
5.6.110.0100.03720.98
5.6.100.0000.05021.17
5.6.90.0030.04321.04
5.6.80.0030.04020.53
5.6.70.0000.04320.36
5.6.60.0070.04720.55
5.6.50.0030.04020.44
5.6.40.0000.04320.33
5.6.30.0070.03720.54
5.6.20.0100.05020.40
5.6.10.0100.07320.50
5.6.00.0070.03720.39
5.5.380.0070.08320.44
5.5.370.0130.06720.50
5.5.360.0100.07020.37
5.5.350.0100.08020.42
5.5.340.0170.06020.95
5.5.330.0030.05720.86
5.5.320.0000.04320.90
5.5.310.0030.04020.90
5.5.300.0070.03320.93
5.5.290.0030.04020.96
5.5.280.0000.04320.78
5.5.270.0000.04020.79
5.5.260.0000.04320.86
5.5.250.0070.03720.59
5.5.240.0070.03720.29
5.5.230.0070.03720.19
5.5.220.0100.03320.06
5.5.210.0070.03720.18
5.5.200.0100.03320.29
5.5.190.0000.04020.13
5.5.180.0030.06720.17
5.5.160.0070.04320.19
5.5.150.0100.04320.21
5.5.140.0030.03320.29
5.5.130.0070.03720.14
5.5.120.0070.03720.15
5.5.110.0070.03020.18
5.5.100.0070.02720.14
5.5.90.0000.04020.11
5.5.80.0030.05020.20
5.5.70.0030.05020.05
5.5.60.0030.04320.10
5.5.50.0130.07320.14
5.5.40.0100.03320.07
5.5.30.0030.04720.07
5.5.20.0130.05020.14
5.5.10.0270.04020.04
5.5.00.0130.07020.04
5.4.450.0030.05019.23
5.4.440.0030.04019.45
5.4.430.0000.04019.20
5.4.420.0070.03719.17
5.4.410.0000.04019.23
5.4.400.0100.03319.15
5.4.390.0070.03719.12
5.4.380.0070.03718.87
5.4.370.0030.03319.16
5.4.360.0100.04719.16
5.4.350.0000.04019.03
5.4.340.0100.04319.04
5.4.320.0100.03319.13
5.4.310.0030.03719.23
5.4.300.0000.03319.12
5.4.290.0000.04719.24
5.4.280.0000.05319.23
5.4.270.0070.03018.94
5.4.260.0070.03318.87
5.4.250.0030.05019.12
5.4.240.0100.05319.23
5.4.230.0100.06718.87
5.4.220.0070.04318.87
5.4.210.0000.04319.04
5.4.200.0070.07319.11
5.4.190.0030.04719.02
5.4.180.0070.07319.11
5.4.170.0000.07019.17
5.4.160.0030.07319.14
5.4.150.0130.06719.02
5.4.140.0130.06316.47
5.4.130.0000.04316.44
5.4.120.0100.06716.34
5.4.110.0030.07716.45
5.4.100.0170.06316.57
5.4.90.0070.04716.57
5.4.80.0070.07016.40
5.4.70.0070.08016.51
5.4.60.0100.04716.46
5.4.50.0130.06716.37
5.4.40.0070.07716.51
5.4.30.0230.05716.41
5.4.20.0130.07016.49
5.4.10.0030.07716.32
5.4.00.0070.06015.77
5.3.290.0170.02314.68
5.3.280.0030.07714.63
5.3.270.0030.08014.75
5.3.260.0170.07314.61
5.3.250.0070.04714.66
5.3.240.0100.08714.63
5.3.230.0070.03714.74
5.3.220.0070.07314.71
5.3.210.0070.08014.73
5.3.200.0000.04314.68
5.3.190.0000.04714.67
5.3.180.0100.06014.61
5.3.170.0070.05714.58
5.3.160.0070.06714.63
5.3.150.0100.06314.58
5.3.140.0070.07714.75
5.3.130.0030.08014.65
5.3.120.0130.07014.62
5.3.110.0070.05314.69
5.3.100.0170.06314.23
5.3.90.0130.06714.13
5.3.80.0100.03714.10
5.3.70.0100.06314.16
5.3.60.0070.07014.10
5.3.50.0170.06014.03
5.3.40.0070.07014.12
5.3.30.0230.06013.94
5.3.20.0030.07313.85
5.3.10.0000.07013.61
5.3.00.0100.06313.82
5.2.170.0030.04711.12
5.2.160.0070.05311.23
5.2.150.0030.04311.31
5.2.140.0100.06011.11
5.2.130.0070.06011.26
5.2.120.0070.03711.09
5.2.110.0030.04011.06
5.2.100.0100.06011.05
5.2.90.0030.06711.06
5.2.80.0100.05711.02
5.2.70.0070.03311.23
5.2.60.0000.06311.04
5.2.50.0070.04311.09
5.2.40.0030.05011.19
5.2.30.0000.04010.91
5.2.20.0070.06711.07
5.2.10.0100.04710.82
5.2.00.0070.06010.78
5.1.60.0070.04010.55
5.1.50.0070.05010.55
5.1.40.0030.04710.55
5.1.30.0070.05310.55
5.1.20.0200.03310.55
5.1.10.0070.05710.55
5.1.00.0030.05310.55
5.0.50.0030.04010.55
5.0.40.0070.03010.55
5.0.30.0030.05310.55
5.0.20.0000.02310.55
5.0.10.0030.05010.55
5.0.00.0000.07010.55
4.4.90.0070.03310.55
4.4.80.0000.04010.55
4.4.70.0030.02310.55
4.4.60.0030.02010.55
4.4.50.0030.02710.55
4.4.40.0070.03310.55
4.4.30.0030.03010.55
4.4.20.0070.03010.55
4.4.10.0100.02310.55
4.4.00.0030.05710.55
4.3.110.0030.03310.55
4.3.100.0030.02010.55
4.3.90.0070.03010.55
4.3.80.0000.04710.55
4.3.70.0000.03710.55
4.3.60.0000.03310.55
4.3.50.0030.03710.55
4.3.40.0070.04710.55
4.3.30.0000.03010.55
4.3.20.0030.02710.55
4.3.10.0030.03710.55
4.3.00.0000.02710.55

preferences:
46.47 ms | 401 KiB | 5 Q