3v4l.org

run code in 300+ PHP versions simultaneously
<?php $colors = array( array(0,0,0), array(255,0,0), array(0,255,0), array(0,0,255), array(255,255,0), array(0,255,255), array(255,0,255), array(192,192,192), array(255,255,255) ); function colorToLum($r, $g, $b) { return (0.299 * $r + 0.587 * $g + 0.114 * $g); } usort( $colors, function ($one, $two) { $lumOne = colorToLum($one[0], $one[1], $one[2]); $lumTwo = colorToLum($two[0], $two[1], $two[2]); return $lumTwo - $lumOne; } ); var_dump($colors);
Output for git.master, git.master_jit, rfc.property-hooks
array(9) { [0]=> array(3) { [0]=> int(255) [1]=> int(255) [2]=> int(0) } [1]=> array(3) { [0]=> int(255) [1]=> int(255) [2]=> int(255) } [2]=> array(3) { [0]=> int(192) [1]=> int(192) [2]=> int(192) } [3]=> array(3) { [0]=> int(0) [1]=> int(255) [2]=> int(0) } [4]=> array(3) { [0]=> int(0) [1]=> int(255) [2]=> int(255) } [5]=> array(3) { [0]=> int(255) [1]=> int(0) [2]=> int(0) } [6]=> array(3) { [0]=> int(255) [1]=> int(0) [2]=> int(255) } [7]=> array(3) { [0]=> int(0) [1]=> int(0) [2]=> int(0) } [8]=> array(3) { [0]=> int(0) [1]=> int(0) [2]=> int(255) } }

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.91 ms | 402 KiB | 8 Q