3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ValueException extends Exception { /* You should have something like this already */ } function buildColumnFilter($colnum, $value) { return function($row) use ($colnum, $value) { return isset($row[$colnum]) && $row[$colnum] === $value; }; } function findColNumByName($table, $name) { if (!in_array($name, $table[0])) { throw new ValueException($name); } return array_search($name, $table[0]); } $triggers = array( array('description', 'triggerid'), array('Issue here', 2), array('Issue 3 here', 3), array('Issue 4 here', 4), ); $events = array( array('hostname', 'objectid'), array('john', 2), array('mike', 3), array('mike', 4), ); var_dump(array_filter($triggers, buildColumnFilter(findColNumByName($triggers, 'triggerid'), 2))); var_dump(array_filter($events, buildColumnFilter(findColNumByName($events, 'objectid'), 2)));
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [1]=> array(2) { [0]=> string(10) "Issue here" [1]=> int(2) } } array(1) { [1]=> array(2) { [0]=> string(4) "john" [1]=> int(2) } }

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