3v4l.org

run code in 300+ PHP versions simultaneously
<?php $log = array ( array('Red', 'Steel'), array('Red', 'Wood'), array('Blue', 'Wood') ); $materials = array(); $colors = array(); foreach($log as $line) { $colors[$line[0]] = (!isset($colors[$line[0]])) ? 1 : $colors[$line[0]] + 1; $materials[$line[1]] = (!isset($materials[$line[1]])) ? 1 : $materials[$line[1]] + 1; } ?> <h2>Colors</h2>\n <?php foreach ($colors as $color => $amount) echo "{$color} => {$amount}<br>\n"; ?> <h2>Materials</h2>\n <?php foreach ($materials as $material => $amount) echo "{$material} => {$amount}<br>\n"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
<h2>Colors</h2>\n Red => 2<br> Blue => 1<br> <h2>Materials</h2>\n Steel => 1<br> Wood => 2<br>

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:
39.22 ms | 401 KiB | 8 Q