3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); // Make a bit, honkin test array // You may need to adjust this depth to avoid memory limit errors $testArray = fillArray( 0, 5 ); // Time json encoding $start = microtime( true ); json_encode( $testArray ); $jsonTime = microtime( true ) - $start; //echo "JSON encoded in $jsonTime seconds<br>"; // Time serialization $start = microtime( true ); serialize( $testArray ); $serializeTime = microtime( true ) - $start; //echo "PHP serialized in $serializeTime seconds<br>"; // Compare them if ( $jsonTime < $serializeTime ) { echo "json_encode() was roughly " . number_format( ($serializeTime / $jsonTime - 1 ) * 100, 2 ) . "% faster than serialize()"; } else if ( $serializeTime < $jsonTime ) { echo "serialize() was roughly " . number_format( ($jsonTime / $serializeTime - 1 ) * 100, 2 ) . "% faster than json_encode()"; } else { echo 'Unpossible!'; } function fillArray( $depth, $max ) { static $seed; if ( is_null( $seed ) ) { $seed = array( 'a', 2, 'c', 4, 'e', 6, 'g', 8, 'i', 10 ); } if ( $depth < $max ) { $node = array(); foreach ( $seed as $key ) { $node[$key] = fillArray( $depth + 1, $max ); } return $node; } return 'empty'; }
Output for 7.4.1
json_encode() was roughly 20.80% faster than serialize()
Output for 7.4.0
json_encode() was roughly 9.47% faster than serialize()
Output for 7.3.13
json_encode() was roughly 37.93% faster than serialize()
Output for 7.3.12
json_encode() was roughly 7.67% faster than serialize()
Output for 7.3.11
json_encode() was roughly 9.53% faster than serialize()
Output for 7.3.10
json_encode() was roughly 12.05% faster than serialize()
Output for 7.3.9
json_encode() was roughly 12.15% faster than serialize()
Output for 7.3.8
json_encode() was roughly 12.29% faster than serialize()
Output for 7.3.7
json_encode() was roughly 4.09% faster than serialize()
Output for 7.3.6
json_encode() was roughly 15.06% faster than serialize()
Output for 7.3.5
serialize() was roughly 2.57% faster than json_encode()
Output for 7.3.4
json_encode() was roughly 12.64% faster than serialize()
Output for 7.3.3
json_encode() was roughly 12.47% faster than serialize()
Output for 7.3.2
json_encode() was roughly 12.93% faster than serialize()
Output for 7.3.1
json_encode() was roughly 13.37% faster than serialize()
Output for 7.3.0
json_encode() was roughly 10.93% faster than serialize()
Output for 7.2.26
json_encode() was roughly 7.43% faster than serialize()
Output for 7.2.25
json_encode() was roughly 12.25% faster than serialize()
Output for 7.2.24
json_encode() was roughly 10.41% faster than serialize()
Output for 7.2.23
json_encode() was roughly 6.59% faster than serialize()
Output for 7.2.22
json_encode() was roughly 13.08% faster than serialize()
Output for 7.2.21
json_encode() was roughly 8.73% faster than serialize()
Output for 7.2.20
json_encode() was roughly 13.65% faster than serialize()
Output for 7.1.0, 7.2.19
json_encode() was roughly 10.87% faster than serialize()
Output for 7.2.18
json_encode() was roughly 11.50% faster than serialize()
Output for 7.2.17
json_encode() was roughly 13.51% faster than serialize()
Output for 7.2.16
json_encode() was roughly 14.47% faster than serialize()
Output for 7.2.15
json_encode() was roughly 9.29% faster than serialize()
Output for 7.2.14
json_encode() was roughly 7.87% faster than serialize()
Output for 7.2.13
json_encode() was roughly 8.10% faster than serialize()
Output for 7.2.12
json_encode() was roughly 33.65% faster than serialize()
Output for 7.2.11
json_encode() was roughly 8.93% faster than serialize()
Output for 7.2.10
json_encode() was roughly 16.56% faster than serialize()
Output for 7.2.9
json_encode() was roughly 8.17% faster than serialize()
Output for 7.2.8
json_encode() was roughly 7.95% faster than serialize()
Output for 7.2.7
json_encode() was roughly 14.49% faster than serialize()
Output for 7.2.6
json_encode() was roughly 9.38% faster than serialize()
Output for 7.2.5
json_encode() was roughly 8.13% faster than serialize()
Output for 7.2.4
json_encode() was roughly 9.97% faster than serialize()
Output for 7.2.3
json_encode() was roughly 5.42% faster than serialize()
Output for 7.2.2
json_encode() was roughly 9.99% faster than serialize()
Output for 7.2.1
json_encode() was roughly 9.94% faster than serialize()
Output for 7.2.0
json_encode() was roughly 9.86% faster than serialize()
Output for 7.1.33
json_encode() was roughly 4.74% faster than serialize()
Output for 7.1.32
json_encode() was roughly 5.58% faster than serialize()
Output for 7.1.31
json_encode() was roughly 24.12% faster than serialize()
Output for 7.1.30
json_encode() was roughly 14.18% faster than serialize()
Output for 7.1.22, 7.1.29
json_encode() was roughly 4.55% faster than serialize()
Output for 7.1.28
json_encode() was roughly 4.68% faster than serialize()
Output for 7.1.27
json_encode() was roughly 6.08% faster than serialize()
Output for 7.1.26
json_encode() was roughly 2.80% faster than serialize()
Output for 7.1.25
json_encode() was roughly 5.20% faster than serialize()
Output for 7.1.24
json_encode() was roughly 6.02% faster than serialize()
Output for 7.1.23
json_encode() was roughly 7.00% faster than serialize()
Output for 7.1.21
json_encode() was roughly 5.63% faster than serialize()
Output for 7.1.20
json_encode() was roughly 4.51% faster than serialize()
Output for 7.1.19
json_encode() was roughly 4.12% faster than serialize()
Output for 7.0.13, 7.1.18
json_encode() was roughly 8.60% faster than serialize()
Output for 7.0.18, 7.1.17
json_encode() was roughly 6.65% faster than serialize()
Output for 7.1.16
json_encode() was roughly 6.21% faster than serialize()
Output for 7.1.15
json_encode() was roughly 6.34% faster than serialize()
Output for 7.1.14
json_encode() was roughly 8.66% faster than serialize()
Output for 7.1.13
json_encode() was roughly 7.09% faster than serialize()
Output for 7.1.12
json_encode() was roughly 4.81% faster than serialize()
Output for 7.0.4, 7.1.11
json_encode() was roughly 7.04% faster than serialize()
Output for 7.1.10
json_encode() was roughly 2.58% faster than serialize()
Output for 7.1.9
json_encode() was roughly 4.47% faster than serialize()
Output for 7.1.8
json_encode() was roughly 6.43% faster than serialize()
Output for 7.1.7
json_encode() was roughly 5.45% faster than serialize()
Output for 7.1.6
json_encode() was roughly 4.45% faster than serialize()
Output for 7.1.5
json_encode() was roughly 5.34% faster than serialize()
Output for 7.1.4
json_encode() was roughly 8.00% faster than serialize()
Output for 7.1.3
json_encode() was roughly 6.88% faster than serialize()
Output for 7.1.2
json_encode() was roughly 4.77% faster than serialize()
Output for 7.1.1
json_encode() was roughly 5.31% faster than serialize()
Output for 7.0.33
json_encode() was roughly 11.87% faster than serialize()
Output for 7.0.32
json_encode() was roughly 10.37% faster than serialize()
Output for 7.0.31
json_encode() was roughly 7.10% faster than serialize()
Output for 7.0.30
json_encode() was roughly 9.50% faster than serialize()
Output for 7.0.29
json_encode() was roughly 11.70% faster than serialize()
Output for 7.0.28
json_encode() was roughly 12.74% faster than serialize()
Output for 7.0.27
json_encode() was roughly 12.19% faster than serialize()
Output for 7.0.26
json_encode() was roughly 5.79% faster than serialize()
Output for 7.0.25
json_encode() was roughly 12.38% faster than serialize()
Output for 7.0.24
json_encode() was roughly 6.44% faster than serialize()
Output for 7.0.23
json_encode() was roughly 9.87% faster than serialize()
Output for 7.0.22
json_encode() was roughly 12.98% faster than serialize()
Output for 7.0.21
json_encode() was roughly 9.70% faster than serialize()
Output for 7.0.20
json_encode() was roughly 8.64% faster than serialize()
Output for 7.0.19
json_encode() was roughly 10.32% faster than serialize()
Output for 7.0.17
json_encode() was roughly 8.81% faster than serialize()
Output for 7.0.16
json_encode() was roughly 9.72% faster than serialize()
Output for 7.0.15
json_encode() was roughly 6.38% faster than serialize()
Output for 7.0.14
json_encode() was roughly 8.74% faster than serialize()
Output for 7.0.12
json_encode() was roughly 12.13% faster than serialize()
Output for 7.0.11
json_encode() was roughly 11.63% faster than serialize()
Output for 7.0.10
json_encode() was roughly 7.25% faster than serialize()
Output for 7.0.9
json_encode() was roughly 8.97% faster than serialize()
Output for 7.0.8
json_encode() was roughly 10.76% faster than serialize()
Output for 7.0.7
json_encode() was roughly 6.52% faster than serialize()
Output for 7.0.6
json_encode() was roughly 8.06% faster than serialize()
Output for 7.0.5
json_encode() was roughly 3.45% faster than serialize()
Output for 7.0.3
json_encode() was roughly 14.38% faster than serialize()
Output for 7.0.2
json_encode() was roughly 15.59% faster than serialize()
Output for 7.0.1
json_encode() was roughly 13.70% faster than serialize()
Output for 7.0.0
json_encode() was roughly 6.20% faster than serialize()
Output for 5.6.15, 5.6.40
json_encode() was roughly 229.36% faster than serialize()
Output for 5.5.11, 5.6.39
json_encode() was roughly 228.08% faster than serialize()
Output for 5.6.38
json_encode() was roughly 231.36% faster than serialize()
Output for 5.6.37
json_encode() was roughly 240.24% faster than serialize()
Output for 5.6.36
json_encode() was roughly 259.76% faster than serialize()
Output for 5.6.35
json_encode() was roughly 246.57% faster than serialize()
Output for 5.5.1, 5.6.34
json_encode() was roughly 230.45% faster than serialize()
Output for 5.6.33
json_encode() was roughly 243.26% faster than serialize()
Output for 5.6.32
json_encode() was roughly 247.95% faster than serialize()
Output for 5.6.31
json_encode() was roughly 212.14% faster than serialize()
Output for 5.6.30
json_encode() was roughly 239.50% faster than serialize()
Output for 5.6.29
json_encode() was roughly 247.92% faster than serialize()
Output for 5.6.28
json_encode() was roughly 241.67% faster than serialize()
Output for 5.6.27
json_encode() was roughly 251.04% faster than serialize()
Output for 5.6.26
json_encode() was roughly 179.73% faster than serialize()
Output for 5.6.25
json_encode() was roughly 220.81% faster than serialize()
Output for 5.6.24
json_encode() was roughly 230.83% faster than serialize()
Output for 5.6.23
json_encode() was roughly 226.28% faster than serialize()
Output for 5.6.22
json_encode() was roughly 223.54% faster than serialize()
Output for 5.6.21
json_encode() was roughly 218.52% faster than serialize()
Output for 5.6.20
json_encode() was roughly 298.09% faster than serialize()
Output for 5.6.19
json_encode() was roughly 203.35% faster than serialize()
Output for 5.6.18
json_encode() was roughly 234.86% faster than serialize()
Output for 5.6.17
json_encode() was roughly 221.41% faster than serialize()
Output for 5.6.16
json_encode() was roughly 202.60% faster than serialize()
Output for 5.6.14
json_encode() was roughly 222.19% faster than serialize()
Output for 5.6.13
json_encode() was roughly 240.29% faster than serialize()
Output for 5.6.12
json_encode() was roughly 220.28% faster than serialize()
Output for 5.6.11
json_encode() was roughly 166.68% faster than serialize()
Output for 5.6.10
json_encode() was roughly 179.51% faster than serialize()
Output for 5.6.9
json_encode() was roughly 236.84% faster than serialize()
Output for 5.6.8
json_encode() was roughly 250.98% faster than serialize()
Output for 5.6.7
json_encode() was roughly 179.08% faster than serialize()
Output for 5.6.6
json_encode() was roughly 103.88% faster than serialize()
Output for 5.6.5
json_encode() was roughly 226.56% faster than serialize()
Output for 5.6.4
json_encode() was roughly 212.21% faster than serialize()
Output for 5.6.3
json_encode() was roughly 219.67% faster than serialize()
Output for 5.6.2
json_encode() was roughly 237.31% faster than serialize()
Output for 5.6.1
json_encode() was roughly 228.68% faster than serialize()
Output for 5.6.0
json_encode() was roughly 228.60% faster than serialize()
Output for 5.5.38
json_encode() was roughly 216.20% faster than serialize()
Output for 5.5.37
json_encode() was roughly 188.14% faster than serialize()
Output for 5.5.36
json_encode() was roughly 225.39% faster than serialize()
Output for 5.5.35
json_encode() was roughly 240.57% faster than serialize()
Output for 5.5.34
json_encode() was roughly 242.45% faster than serialize()
Output for 5.5.33
json_encode() was roughly 214.67% faster than serialize()
Output for 5.5.32
json_encode() was roughly 205.43% faster than serialize()
Output for 5.5.31
json_encode() was roughly 182.54% faster than serialize()
Output for 5.5.30
json_encode() was roughly 232.51% faster than serialize()
Output for 5.5.29
json_encode() was roughly 211.51% faster than serialize()
Output for 5.5.28
json_encode() was roughly 119.30% faster than serialize()
Output for 5.5.27
json_encode() was roughly 134.01% faster than serialize()
Output for 5.5.26
json_encode() was roughly 272.67% faster than serialize()
Output for 5.5.25
json_encode() was roughly 391.01% faster than serialize()
Output for 5.5.24
json_encode() was roughly 231.48% faster than serialize()
Output for 5.5.23
json_encode() was roughly 234.11% faster than serialize()
Output for 5.5.22
json_encode() was roughly 251.30% faster than serialize()
Output for 5.5.21
json_encode() was roughly 264.82% faster than serialize()
Output for 5.5.20
json_encode() was roughly 212.01% faster than serialize()
Output for 5.5.19
json_encode() was roughly 211.96% faster than serialize()
Output for 5.5.18
json_encode() was roughly 223.45% faster than serialize()
Output for 5.5.16
json_encode() was roughly 253.59% faster than serialize()
Output for 5.5.15
json_encode() was roughly 184.29% faster than serialize()
Output for 5.5.14
json_encode() was roughly 298.29% faster than serialize()
Output for 5.5.13
json_encode() was roughly 227.34% faster than serialize()
Output for 5.5.12
json_encode() was roughly 373.30% faster than serialize()
Output for 5.5.10
json_encode() was roughly 217.09% faster than serialize()
Output for 5.5.9
json_encode() was roughly 259.56% faster than serialize()
Output for 5.5.8
json_encode() was roughly 330.97% faster than serialize()
Output for 5.5.7
json_encode() was roughly 227.33% faster than serialize()
Output for 5.5.6
json_encode() was roughly 180.91% faster than serialize()
Output for 5.5.5
json_encode() was roughly 227.62% faster than serialize()
Output for 5.5.4
json_encode() was roughly 225.66% faster than serialize()
Output for 5.5.3
json_encode() was roughly 303.48% faster than serialize()
Output for 5.5.2
json_encode() was roughly 258.25% faster than serialize()
Output for 5.5.0
json_encode() was roughly 206.98% faster than serialize()
Output for 5.4.45
json_encode() was roughly 187.50% faster than serialize()
Output for 5.4.44
json_encode() was roughly 114.25% faster than serialize()
Output for 5.4.43
json_encode() was roughly 190.62% faster than serialize()
Output for 5.4.42
json_encode() was roughly 221.40% faster than serialize()
Output for 5.4.41
json_encode() was roughly 196.54% faster than serialize()
Output for 5.4.7, 5.4.40
json_encode() was roughly 210.95% faster than serialize()
Output for 5.4.39
json_encode() was roughly 210.45% faster than serialize()
Output for 5.4.38
json_encode() was roughly 255.08% faster than serialize()
Output for 5.4.37
json_encode() was roughly 240.59% faster than serialize()
Output for 5.4.36
json_encode() was roughly 174.07% faster than serialize()
Output for 5.4.35
json_encode() was roughly 212.46% faster than serialize()
Output for 5.4.34
json_encode() was roughly 256.77% faster than serialize()
Output for 5.4.32
json_encode() was roughly 233.42% faster than serialize()
Output for 5.4.31
json_encode() was roughly 335.09% faster than serialize()
Output for 5.4.30
json_encode() was roughly 272.78% faster than serialize()
Output for 5.4.29
json_encode() was roughly 242.33% faster than serialize()
Output for 5.4.28
json_encode() was roughly 105.17% faster than serialize()
Output for 5.4.27
json_encode() was roughly 210.69% faster than serialize()
Output for 5.4.26
json_encode() was roughly 508.64% faster than serialize()
Output for 5.4.25
json_encode() was roughly 159.62% faster than serialize()
Output for 5.4.24
json_encode() was roughly 223.42% faster than serialize()
Output for 5.4.23
json_encode() was roughly 206.08% faster than serialize()
Output for 5.4.22
json_encode() was roughly 296.46% faster than serialize()
Output for 5.4.21
json_encode() was roughly 196.99% faster than serialize()
Output for 5.4.20
json_encode() was roughly 240.65% faster than serialize()
Output for 5.4.19
json_encode() was roughly 206.97% faster than serialize()
Output for 5.4.18
json_encode() was roughly 248.77% faster than serialize()
Output for 5.4.17
json_encode() was roughly 295.97% faster than serialize()
Output for 5.4.16
json_encode() was roughly 245.97% faster than serialize()
Output for 5.4.15
json_encode() was roughly 277.31% faster than serialize()
Output for 5.4.14
json_encode() was roughly 298.42% faster than serialize()
Output for 5.4.13
json_encode() was roughly 455.74% faster than serialize()
Output for 5.4.12
json_encode() was roughly 232.37% faster than serialize()
Output for 5.4.11
json_encode() was roughly 248.27% faster than serialize()
Output for 5.4.10
json_encode() was roughly 211.92% faster than serialize()
Output for 5.4.9
json_encode() was roughly 252.67% faster than serialize()
Output for 5.4.8
json_encode() was roughly 223.76% faster than serialize()
Output for 5.4.6
json_encode() was roughly 169.85% faster than serialize()
Output for 5.4.5
json_encode() was roughly 234.84% faster than serialize()
Output for 5.4.4
json_encode() was roughly 173.24% faster than serialize()
Output for 5.4.3
json_encode() was roughly 306.65% faster than serialize()
Output for 5.4.2
json_encode() was roughly 187.22% faster than serialize()
Output for 5.4.1
json_encode() was roughly 270.80% faster than serialize()
Output for 5.4.0
json_encode() was roughly 119.63% faster than serialize()
Output for 5.3.29
json_encode() was roughly 143.48% faster than serialize()
Output for 5.3.28
json_encode() was roughly 252.41% faster than serialize()
Output for 5.3.27
json_encode() was roughly 236.56% faster than serialize()
Output for 5.3.26
json_encode() was roughly 219.52% faster than serialize()
Output for 5.3.25
json_encode() was roughly 180.83% faster than serialize()
Output for 5.3.24
json_encode() was roughly 270.10% faster than serialize()
Output for 5.3.23
json_encode() was roughly 223.50% faster than serialize()
Output for 5.3.22
json_encode() was roughly 186.67% faster than serialize()
Output for 5.3.21
json_encode() was roughly 225.38% faster than serialize()
Output for 5.3.20
json_encode() was roughly 238.22% faster than serialize()
Output for 5.3.19
json_encode() was roughly 92.13% faster than serialize()
Output for 5.3.18
json_encode() was roughly 246.39% faster than serialize()
Output for 5.3.17
json_encode() was roughly 255.28% faster than serialize()
Output for 5.3.16
json_encode() was roughly 230.60% faster than serialize()
Output for 5.3.15
json_encode() was roughly 237.66% faster than serialize()
Output for 5.3.14
json_encode() was roughly 214.91% faster than serialize()
Output for 5.3.13
json_encode() was roughly 325.39% faster than serialize()
Output for 5.3.12
json_encode() was roughly 265.03% faster than serialize()
Output for 5.3.11
json_encode() was roughly 182.00% faster than serialize()
Output for 5.3.10
json_encode() was roughly 337.73% faster than serialize()
Output for 5.3.9
json_encode() was roughly 260.38% faster than serialize()
Output for 5.3.8
json_encode() was roughly 323.50% faster than serialize()
Output for 5.3.7
json_encode() was roughly 245.50% faster than serialize()
Output for 5.3.6
json_encode() was roughly 252.86% faster than serialize()
Output for 5.3.5
json_encode() was roughly 193.41% faster than serialize()
Output for 5.3.4
json_encode() was roughly 290.34% faster than serialize()
Output for 5.3.3
json_encode() was roughly 247.58% faster than serialize()
Output for 5.3.2
json_encode() was roughly 331.05% faster than serialize()
Output for 5.3.1
json_encode() was roughly 217.79% faster than serialize()
Output for 5.3.0
json_encode() was roughly 241.40% faster than serialize()
Output for 5.2.17
json_encode() was roughly 230.28% faster than serialize()
Output for 5.2.16
json_encode() was roughly 262.99% faster than serialize()
Output for 5.2.15
json_encode() was roughly 227.12% faster than serialize()
Output for 5.2.14
json_encode() was roughly 261.65% faster than serialize()
Output for 5.2.13
json_encode() was roughly 219.12% faster than serialize()
Output for 5.2.12
json_encode() was roughly 224.34% faster than serialize()
Output for 5.2.11
json_encode() was roughly 218.93% faster than serialize()
Output for 5.2.10
json_encode() was roughly 252.28% faster than serialize()
Output for 5.2.9
json_encode() was roughly 324.93% faster than serialize()
Output for 5.2.8
json_encode() was roughly 69.68% faster than serialize()
Output for 5.2.7
json_encode() was roughly 238.96% faster than serialize()
Output for 5.2.6
json_encode() was roughly 400.27% faster than serialize()
Output for 5.2.5
json_encode() was roughly 327.35% faster than serialize()
Output for 5.2.4
json_encode() was roughly 299.84% faster than serialize()
Output for 5.2.3
json_encode() was roughly 306.37% faster than serialize()
Output for 5.2.2
json_encode() was roughly 258.75% faster than serialize()
Output for 5.2.1
json_encode() was roughly 84.94% faster than serialize()
Output for 5.2.0
json_encode() was roughly 16.00% faster than serialize()
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/UvrB5 on line 12
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/UvrB5 on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/UvrB5 on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/UvrB5 on line 12

preferences:
206.92 ms | 401 KiB | 323 Q