3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array( 'keywordid' => 98, 'keyword' => 'sample keyword 34', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 99, 'keyword' => 'sample keyword 35', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 100, 'keyword' => 'sample keyword 36', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 97, 'keyword' => 'sample keyword 37', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 96, 'keyword' => 'sample keyword 38', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 95, 'keyword' => 'sample keyword 39', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 94, 'keyword' => 'sample keyword 40', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 93, 'keyword' => 'sample keyword 41', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 92, 'keyword' => 'sample keyword 42', 'type' => 'NATURAL', 'longname' => 'UK' ), array( 'keywordid' => 91, 'keyword' => 'sample keyword 43', 'type' => 'NATURAL', 'longname' => 'UK' ) ); $order = array(100, 91, 95); $order = array_flip($order); $noMatchBucket = count($order); $temp = array_fill(0, $noMatchBucket + 1, array()); foreach ($data as $item) { $bucket = isset($order[$item['keywordid']]) ? $order[$item['keywordid']] : $noMatchBucket; $temp[$bucket][] = $item; } $data = array(); foreach ($temp as $bucket) { $data = array_merge($data, $bucket); } print_r($data);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [keywordid] => 100 [keyword] => sample keyword 36 [type] => NATURAL [longname] => UK ) [1] => Array ( [keywordid] => 91 [keyword] => sample keyword 43 [type] => NATURAL [longname] => UK ) [2] => Array ( [keywordid] => 95 [keyword] => sample keyword 39 [type] => NATURAL [longname] => UK ) [3] => Array ( [keywordid] => 98 [keyword] => sample keyword 34 [type] => NATURAL [longname] => UK ) [4] => Array ( [keywordid] => 99 [keyword] => sample keyword 35 [type] => NATURAL [longname] => UK ) [5] => Array ( [keywordid] => 97 [keyword] => sample keyword 37 [type] => NATURAL [longname] => UK ) [6] => Array ( [keywordid] => 96 [keyword] => sample keyword 38 [type] => NATURAL [longname] => UK ) [7] => Array ( [keywordid] => 94 [keyword] => sample keyword 40 [type] => NATURAL [longname] => UK ) [8] => Array ( [keywordid] => 93 [keyword] => sample keyword 41 [type] => NATURAL [longname] => UK ) [9] => Array ( [keywordid] => 92 [keyword] => sample keyword 42 [type] => NATURAL [longname] => UK ) )

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:
27.97 ms | 410 KiB | 5 Q