3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lookup = [ ['a', 'ape'], ['b', 'bee'], ['a', 'ant'], ['d', 'dog'], ['b', 'bat'], ['a', 'asp'], ]; function getValueAt($lookup, $rowIndex, $columnIndex) { return $lookup[$rowIndex][$columnIndex]; } $columnIndex = 0; $values = []; for ($i = 0; $i < count($lookup); ++$i) { $values[getValueAt($lookup, $i, $columnIndex)][] = $i; } var_export($values); echo "\n"; $onlyRecurringRows = array_filter($values, fn($row) => count($row) > 1); var_export($onlyRecurringRows);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 'a' => array ( 0 => 0, 1 => 2, 2 => 5, ), 'b' => array ( 0 => 1, 1 => 4, ), 'd' => array ( 0 => 3, ), ) array ( 'a' => array ( 0 => 0, 1 => 2, 2 => 5, ), 'b' => array ( 0 => 1, 1 => 4, ), )

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:
38.2 ms | 406 KiB | 5 Q