3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ null, false, 1, 1.5, 'string', ['string in array without keys'], ['key' => 'string in array with keys'], [ 'multi-dim array' => 'string', 'sub-array' => [ 1, 2, 3] ], ]; foreach($test as $l10n) { echo PHP_EOL,'=======================', PHP_EOL; echo PHP_EOL,'Input',PHP_EOL; var_dump($l10n); $copy = $l10n; foreach ( (array) $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } $encoded1 = json_encode( $l10n ); echo PHP_EOL,'Original output',PHP_EOL; var_dump($encoded1); $l10n = $copy; if ( is_string( $l10n ) ) { $l10n = html_entity_decode( (string) $l10n, ENT_QUOTES, 'UTF-8' ); } else { $l10n = (array) $l10n; foreach ( $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $encoded2 = json_encode( $l10n ); echo PHP_EOL,'Patch Peter output',PHP_EOL; var_dump($encoded2); if ($encoded1 !== $encoded2) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } $l10n = $copy; if ( ! is_array( $l10n ) ) { $l10n = html_entity_decode( (string) $l10n, ENT_QUOTES, 'UTF-8' ); } else { foreach ( $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $encoded3 = json_encode( $l10n ); echo PHP_EOL,'Patch Sergey output',PHP_EOL; var_dump($encoded3); if ($encoded1 !== $encoded3) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } $l10n = $copy; if ( ! is_array( $l10n ) ) { // Throw the _doing_it_wrong_warning. $l10n = (array) $l10n; } foreach ( $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } $encoded4 = json_encode( $l10n ); echo PHP_EOL,'Patch 1 Juliette output',PHP_EOL; var_dump($encoded4); if ($encoded1 !== $encoded4) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } $l10n = $copy; if ( ! is_array( $l10n ) ) { // Throw the _doing_it_wrong_warning. } if ( is_string( $l10n ) ) { $l10n = html_entity_decode( (string) $l10n, ENT_QUOTES, 'UTF-8' ); } else { foreach ( (array) $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $encoded5 = json_encode( $l10n ); echo PHP_EOL,'Patch 2 Juliette output',PHP_EOL; var_dump($encoded5); if ($encoded1 !== $encoded5) { echo "*** BC-break detected in patch!! ***", 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.4.20.0110.00018.07
8.4.10.0080.00022.10
8.3.150.0030.01217.14
8.3.140.0040.01516.92
8.3.130.0090.00018.42
8.3.120.0080.00418.77
8.3.110.0070.01020.94
8.3.100.0060.00320.41
8.3.90.0040.01226.77
8.3.80.0000.00919.36
8.3.70.0070.00716.74
8.3.60.0090.00618.43
8.3.50.0070.01123.53
8.3.40.0190.00318.82
8.3.30.0080.00818.71
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0000.00826.16
8.2.270.0080.01116.62
8.2.260.0090.00918.75
8.2.250.0110.00418.32
8.2.240.0040.00717.41
8.2.230.0090.00022.58
8.2.220.0030.00624.06
8.2.210.0040.01126.77
8.2.200.0060.00318.88
8.2.190.0070.00718.29
8.2.180.0110.00425.92
8.2.170.0070.00718.99
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0060.00326.16
8.2.120.0040.00426.35
8.2.110.0100.00022.21
8.2.100.0080.00417.84
8.2.90.0080.00017.88
8.2.80.0050.00318.91
8.2.70.0000.00818.05
8.2.60.0000.00918.13
8.2.50.0060.00318.10
8.2.40.0030.00621.08
8.2.30.0060.00319.36
8.2.20.0000.00718.20
8.2.10.0000.00819.23
8.2.00.0030.00519.35
8.1.310.0070.01116.82
8.1.300.0030.00618.29
8.1.290.0000.01030.84
8.1.280.0110.00425.92
8.1.270.0060.00323.73
8.1.260.0060.00328.09
8.1.250.0080.00028.09
8.1.240.0060.00322.42
8.1.230.0040.00820.75
8.1.220.0030.00617.79
8.1.210.0040.00418.77
8.1.200.0080.00317.36
8.1.190.0000.00817.25
8.1.180.0030.00518.10
8.1.170.0000.00818.54
8.1.160.0080.00020.66
8.1.150.0000.00818.99
8.1.140.0040.00420.63
8.1.130.0040.00417.51
8.1.120.0000.00717.48
8.1.110.0060.00317.54
8.1.100.0040.00417.48
8.1.90.0000.00817.46
8.1.80.0080.00017.56
8.1.70.0040.00417.50
8.1.60.0090.00017.64
8.1.50.0000.00917.57
8.1.40.0080.00317.54
8.1.30.0050.00317.59
8.1.20.0000.00817.67
8.1.10.0080.00417.59
8.1.00.0080.00317.55
8.0.300.0040.00418.77
8.0.290.0050.00316.75
8.0.280.0040.00418.55
8.0.270.0000.00716.93
8.0.260.0000.00716.98
8.0.250.0030.00617.08
8.0.240.0030.00317.11
8.0.230.0070.00017.07
8.0.220.0020.00517.00
8.0.210.0000.00716.88
8.0.200.0030.00317.05
8.0.190.0090.00016.97
8.0.180.0040.00417.01
8.0.170.0030.00617.02
8.0.160.0030.00317.00
8.0.150.0070.00016.93
8.0.140.0110.00316.91
8.0.130.0050.00013.50
8.0.120.0000.00816.94
8.0.110.0080.00017.01
8.0.100.0040.00416.83
8.0.90.0040.00417.00
8.0.80.0100.00917.01
8.0.70.0040.00717.04
8.0.60.0040.00416.78
8.0.50.0050.00216.79
8.0.30.0150.01117.07
8.0.20.0130.00816.97
8.0.10.0080.01217.12
8.0.00.0080.01317.28
7.4.330.0030.00315.55
7.4.320.0030.00316.67
7.4.300.0080.00016.65
7.4.290.0000.00816.52
7.4.280.0070.00016.63
7.4.270.0040.00816.65
7.4.260.0000.00613.33
7.4.250.0040.00416.52
7.4.240.0060.00216.57
7.4.230.0040.00416.74
7.4.220.0080.00016.71
7.4.210.0070.01216.63
7.4.200.0000.00816.58
7.4.150.0130.00716.34
7.4.140.0110.00916.44
7.4.130.0120.01216.59
7.4.120.0100.00916.56
7.4.110.0120.00816.53
7.4.100.0040.01516.70
7.4.90.0070.01316.54
7.4.80.0100.00916.61
7.4.70.0150.00316.39
7.4.60.0090.01316.49
7.4.50.0130.01016.62
7.4.40.0170.00416.56
7.4.30.0120.00916.46
7.4.20.0040.01516.62
7.4.10.0110.01116.49
7.4.00.0180.00316.38
7.3.330.0040.00416.52
7.3.320.0060.00013.36
7.3.310.0050.00216.31
7.3.300.0040.00416.48
7.3.290.0110.00716.44
7.3.270.0040.01516.58
7.3.260.0140.02716.41
7.3.250.0090.00916.54
7.3.240.0060.01316.53
7.3.230.0100.01016.38
7.3.220.0100.01016.64
7.3.210.0140.00716.36
7.3.200.0100.01716.55
7.3.190.0090.01216.45
7.3.180.0120.00616.68
7.3.170.0140.00616.34
7.3.160.0190.00216.57
7.3.150.0030.01916.41
7.3.140.0110.01016.42
7.3.130.0180.00416.55
7.3.120.0090.01516.45
7.3.110.0100.01016.43
7.3.100.0130.00716.33
7.3.90.0100.01016.70
7.3.80.0120.00616.61
7.3.70.0200.01016.47
7.3.60.0100.01016.55
7.3.50.0130.00716.46
7.3.40.0110.00716.32
7.3.30.0130.01016.39
7.3.20.0120.00916.45
7.3.10.0050.01716.51
7.3.00.0100.01416.37
7.2.340.0250.00916.65
7.2.330.0310.00316.48
7.2.320.0290.00416.76
7.2.310.0200.01616.81
7.2.300.0190.01616.65
7.2.290.0200.01216.67
7.2.280.0280.00816.70
7.2.270.0260.01316.83
7.2.260.0340.00216.54
7.2.250.0190.01616.79
7.2.240.0240.01216.73
7.2.230.0230.01116.68
7.2.220.0210.01416.58
7.2.210.0220.01516.75
7.2.200.0300.01216.57
7.2.190.0220.00916.66
7.2.180.0230.01416.66
7.2.170.0220.01116.68
7.2.160.0190.01616.55
7.2.150.0240.01216.84
7.2.140.0150.01916.63
7.2.130.0250.01016.54
7.2.120.0230.01216.83
7.2.110.0320.00916.70
7.2.100.0360.00316.75
7.2.90.0370.01116.70
7.2.80.0340.01416.63
7.2.70.0210.02516.70
7.2.60.0180.01916.59
7.2.50.0330.00016.70
7.2.40.0180.01416.76
7.2.30.0290.01516.79
7.2.20.0180.01416.71
7.2.10.0200.01216.76
7.2.00.0260.01016.66
7.1.330.0270.00415.54
7.1.320.0160.01315.66
7.1.310.0270.00915.71
7.1.300.0160.01615.59
7.1.290.0220.01115.48
7.1.280.0260.00715.59
7.1.270.0220.00915.62
7.1.260.0290.00715.46
7.1.250.0360.00015.54
7.1.240.0270.00815.55
7.1.230.0250.00815.46
7.1.220.0230.01015.66
7.1.210.0230.01415.53
7.1.200.0190.01915.52
7.1.190.0240.01715.59
7.1.180.0280.00315.62
7.1.170.0300.00015.68
7.1.160.0190.01015.67
7.1.150.0200.01415.80
7.1.140.0260.00715.54
7.1.130.0230.00615.44
7.1.120.0190.01115.61
7.1.110.0540.01615.57
7.1.100.0200.01015.52
7.1.90.0230.01315.82
7.1.80.0480.00815.51
7.1.70.0220.00815.73
7.1.60.0180.01415.63
7.1.50.0280.00315.53
7.1.40.0220.01215.85
7.1.30.0200.01215.84
7.1.20.0250.01315.51
7.1.10.0230.00615.75
7.1.00.0170.01715.71
7.0.330.0220.01015.07
7.0.320.0260.00715.39
7.0.310.0320.00615.30
7.0.300.0430.00315.18
7.0.290.0200.00815.12
7.0.280.0210.00715.31
7.0.270.0190.01015.44
7.0.260.0220.01115.21
7.0.250.0200.00915.38
7.0.240.0310.00715.15
7.0.230.0210.01115.36
7.0.220.0230.00515.15
7.0.210.0210.00915.16
7.0.200.0150.01215.31
7.0.190.0290.00715.39
7.0.180.0180.01115.40
7.0.170.0100.01715.36
7.0.160.0170.01415.24
7.0.150.0150.01115.29
7.0.140.0240.00515.32
7.0.130.0160.01315.21
7.0.120.0170.01415.30
7.0.110.0250.00415.24
7.0.100.0210.00815.26
7.0.90.0650.00415.22
7.0.80.0290.00515.13
7.0.70.0230.01015.34
7.0.60.0140.01415.38
7.0.50.0270.00415.20
7.0.40.0250.01315.19
7.0.30.0200.00915.12
7.0.20.0210.00715.27
7.0.10.0250.00715.17
7.0.00.0210.00915.26
5.6.400.0320.00316.02
5.6.390.0190.01616.20
5.6.380.0180.02215.91
5.6.370.0240.01016.00
5.6.360.0170.01515.86
5.6.350.0180.01215.84
5.6.340.0150.01916.30
5.6.330.0160.01615.88
5.6.320.0200.01016.08
5.6.310.0270.00516.09
5.6.300.0280.00315.88
5.6.290.0270.00516.23
5.6.280.0180.01916.18
5.6.270.0250.00915.88
5.6.260.0200.01315.86
5.6.250.0220.00715.83
5.6.240.0200.01116.11
5.6.230.0150.01516.07
5.6.220.0260.00315.95
5.6.210.0200.00915.92
5.6.200.0150.01215.66
5.6.190.0270.00915.88
5.6.180.0210.01816.29
5.6.170.0160.01616.11
5.6.160.0260.01116.07
5.6.150.0290.01016.13
5.6.140.0230.01015.95
5.6.130.0260.00916.05
5.6.120.0240.00915.96
5.6.110.0290.00416.16
5.6.100.0260.00416.00
5.6.90.0250.00716.03
5.6.80.0170.01415.80
5.6.70.0180.01115.86
5.6.60.0220.00916.12
5.6.50.0220.01015.99
5.6.40.0230.00916.11
5.6.30.0160.01616.04
5.6.20.0110.02216.02
5.6.10.0270.00815.74
5.6.00.0500.01515.91
5.5.380.0200.01216.18
5.5.370.0200.01016.29
5.5.360.0200.01215.92
5.5.350.0320.01115.95
5.5.340.0350.00916.12
5.5.330.0110.02216.18
5.5.320.0240.00915.74
5.5.310.0270.00615.86
5.5.300.0220.01515.98
5.5.290.0260.01116.06
5.5.280.0270.00615.95
5.5.270.0180.01216.19
5.5.260.0170.01416.03
5.5.250.0240.00915.91
5.5.240.0180.01115.93
5.5.230.0170.01515.83
5.5.220.0170.01715.64
5.5.210.0120.01816.08
5.5.200.0100.02015.73
5.5.190.0170.02216.07
5.5.180.0190.01215.80
5.5.170.0290.00415.61
5.5.160.0210.01215.89
5.5.150.0250.00516.00
5.5.140.0220.01215.91
5.5.130.0250.00816.05
5.5.120.0220.00915.73
5.5.110.0260.01015.86
5.5.100.0280.00716.15
5.5.90.0230.01315.85
5.5.80.0190.01216.15
5.5.70.0180.01315.93
5.5.60.0200.01015.95
5.5.50.0200.01615.70
5.5.40.0230.01015.79
5.5.30.0150.01615.99
5.5.20.0170.01215.77
5.5.10.0230.00815.96
5.5.00.0210.01115.87
5.4.450.0200.00612.66
5.4.440.0090.01612.74
5.4.430.0110.01112.67
5.4.420.0210.00712.88
5.4.410.0190.00612.75
5.4.400.0200.00712.70
5.4.390.0160.01012.50
5.4.380.0180.00612.86
5.4.370.0150.01112.87
5.4.360.0210.00612.82
5.4.350.0250.00412.57
5.4.340.0120.01612.60
5.4.330.0080.01612.79
5.4.320.0110.01512.58
5.4.310.0220.00412.56
5.4.300.0150.01012.84
5.4.290.0170.00912.67
5.4.280.0200.00712.76
5.4.270.0230.01012.61
5.4.260.0200.00612.52
5.4.250.0240.00012.66
5.4.240.0210.00312.71
5.4.230.0180.00612.72
5.4.220.0170.00812.77
5.4.210.0160.00912.83
5.4.200.0190.00812.65
5.4.190.0210.00812.73
5.4.180.0230.00612.66
5.4.170.0150.01112.80
5.4.160.0200.00912.56
5.4.150.0180.00912.77
5.4.140.0260.00712.80
5.4.130.0190.00412.77
5.4.120.0220.00612.69
5.4.110.0200.00812.83
5.4.100.0220.00512.64
5.4.90.0110.01412.82
5.4.80.0240.00312.74
5.4.70.0160.00812.66
5.4.60.0200.00812.65
5.4.50.0110.01412.82
5.4.40.0160.01012.75
5.4.30.0170.01412.69
5.4.20.0180.00612.82
5.4.10.0210.00312.54
5.4.00.0150.01012.66
5.3.290.0170.00712.75
5.3.280.0120.01112.77
5.3.270.0170.00812.73
5.3.260.0210.00912.61
5.3.250.0170.00612.64
5.3.240.0160.00812.65
5.3.230.0190.00812.63
5.3.220.0140.01412.54
5.3.210.0110.01112.64
5.3.200.0150.00812.63
5.3.190.0170.00412.85
5.3.180.0240.00312.79
5.3.170.0170.00713.06
5.3.160.0170.00612.79
5.3.150.0110.01112.95
5.3.140.0220.00712.75
5.3.130.0160.00812.71
5.3.120.0210.00312.80
5.3.110.0140.00912.85
5.3.100.0140.00812.85
5.3.90.0200.00312.74
5.3.80.0090.01312.60
5.3.70.0160.00512.61
5.3.60.0100.01012.77
5.3.50.0160.01012.76
5.3.40.0180.00612.82
5.3.30.0180.00412.66
5.3.20.0130.01012.62
5.3.10.0220.00012.55
5.3.00.0120.00912.49
5.2.170.0150.00511.91
5.2.160.0240.00011.73
5.2.150.0140.00611.77
5.2.140.0160.00411.70
5.2.130.0120.00911.95
5.2.120.0150.00711.67
5.2.110.0130.00611.85
5.2.100.0110.00811.95
5.2.90.0160.00311.73
5.2.80.0110.00811.70
5.2.70.0080.01111.65
5.2.60.0170.00711.82
5.2.50.0190.00611.82
5.2.40.0180.00411.73
5.2.30.0150.00511.68
5.2.20.0100.01311.63
5.2.10.0180.00411.73
5.2.00.0250.00011.36
5.1.60.0120.00810.86
5.1.50.0080.00910.90
5.1.40.0040.01211.02
5.1.30.0100.00711.26
5.1.20.0110.00710.95
5.1.10.0190.00310.87
5.1.00.0130.00310.96
5.0.50.0120.00310.86
5.0.40.0140.00010.86
5.0.30.0090.00510.86
5.0.20.0050.00810.86
5.0.10.0100.00310.86
5.0.00.0060.00610.86
4.4.90.0090.00010.86
4.4.80.0050.00710.86
4.4.70.0090.00010.86
4.4.60.0100.00010.86
4.4.50.0090.00310.86
4.4.40.0050.00510.86
4.4.30.0040.00510.86
4.4.20.0050.00510.86
4.4.10.0040.00510.86
4.4.00.0080.00310.86
4.3.110.0030.00610.86
4.3.100.0110.00010.86
4.3.90.0020.00710.86
4.3.80.0090.00210.86
4.3.70.0030.00610.86
4.3.60.0090.00010.86
4.3.50.0090.00210.86
4.3.40.0050.00510.86
4.3.30.0000.00810.86
4.3.20.0050.00310.86
4.3.10.0000.00810.86
4.3.00.0000.00710.86

preferences:
65.87 ms | 403 KiB | 5 Q