3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $orderedids=array(7, 9, 5, 3); $tags=array( new Tag(3), new Tag(7), new Tag(5), new Tag(9) ); $flipped=array_flip($orderedids); return usort($tags, function($tag1, $tag2) { if $flipped[$tag1->id]<$flipped[$tag2->id] return -1; else if $flipped[$tag1->id]==$flipped[$tag2->id] return 0; else return 1; }); } class Tag { public $id; function __construct($id) { $this->id=$id; } } $rtags=test(); foreach ($rtags as $tag) echo $tag->id." ";

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)
5.6.150.0070.05718.15
5.6.140.0130.07018.15
5.6.130.0000.04318.11
5.6.120.0070.04720.97
5.6.110.0000.06020.97
5.6.100.0170.07021.04
5.6.90.0130.03721.10
5.6.80.0100.08020.43
5.5.300.0030.05317.95
5.5.290.0070.04718.04
5.5.280.0030.04320.98
5.5.270.0000.08720.65
5.5.260.0030.06020.65
5.5.250.0130.05020.75
5.5.240.0300.06320.08

preferences:
140.67 ms | 1394 KiB | 7 Q