3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( 0 => "foo", 1 => "bar", "animal" => "string", 3.13 => "pi", ); $loops = 1000000; printf("Control loop...\n"); $start = microtime(true); function process_array($a) { $s = ""; foreach ($a as $key=>$value) { $s .= "$key=>$value\n"; } } for ($i = 0; $i < $loops; $i++) process_array($a); $elapsed = microtime(true) - $start; printf("Elapsed: %.2f s\n\n", $elapsed); printf("Anonymous lambda function created once and called via reference...\n"); $start = microtime(true); $process_array_lambda = function($a) { $s = ""; foreach ($a as $key=>$value) { $s .= "$key=>$value\n"; } }; for ($i = 0; $i < $loops; $i++) $process_array_lambda($a); $elapsed = microtime(true) - $start; printf("Elapsed: %.2f s\n\n", $elapsed); printf("Anonymous lambda function called directly...\n"); $start = microtime(true); for ($i = 0; $i < $loops; $i++) (function($a) { $s = ""; foreach ($a as $key=>$value) { $s .= "$key=>$value\n"; } })($a); $elapsed = microtime(true) - $start; printf("Elapsed: %.2f s\n\n", $elapsed);

Abusive script

This script was stopped while abusing our resources

Output for git.master_jit
Deprecated: Implicit conversion from float 3.13 to int loses precision in /in/6AABv on line 7 Control loop... Elapsed: 0.44 s Anonymous lambda function created once and called via reference... Elapsed: 0.44 s Anonymous lambda function called directly... Elapsed: 0.53 s
Output for git.master
Deprecated: Implicit conversion from float 3.13 to int loses precision in /in/6AABv on line 7 Control loop... Elapsed: 0.42 s Anonymous lambda function created once and called via reference... Elapsed: 0.44 s Anonymous lambda function called directly... Elapsed: 0.54 s
Output for rfc.property-hooks
Deprecated: Implicit conversion from float 3.13 to int loses precision in /in/6AABv on line 7 Control loop... Elapsed: 0.41 s Anonymous lambda function created once and called via reference... Elapsed: 0.42 s Anonymous lambda function called directly... Elapsed: 0.50 s

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:
46.05 ms | 1167 KiB | 4 Q