3v4l.org

run code in 300+ PHP versions simultaneously
<?php function acceptOne($a) {}; $str = str_repeat('abcd', 64 * 1024); // 256 KiB length $benchFx = function (string $msg, \Closure $fx) { $times = []; for ($i = 0; $i < 10; $i++) { $t = microtime(true); $fx(); $t = microtime(true) - $t; $times[] = $t; } $bestTime = min($times); echo $msg . ': ' . round($bestTime * 1000, 2) . " ms\n"; }; $benchFx('json_encode', function () use ($str) { for ($i = 0; $i < 200; $i++) { $res = json_encode($str); acceptOne($res); } }); $benchFx('serialize', function () use ($str) { for ($i = 0; $i < 200; $i++) { $res = serialize($str); acceptOne($res); } });
Output for git.master_jit
json_encode: 44.51 ms serialize: 15.11 ms
Output for git.master
json_encode: 44.53 ms serialize: 15.11 ms

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
34.67 ms | 406 KiB | 5 Q