3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[ {"title":"The Call of the Wild","author":"Jack London"}, {"title":"Great Expectations","author":"Charles Dickens"}, {"title":"The Voyage of the Beatle","author":"Charles Darwin"} ]'; $array = json_decode($json, true); function searchArrayKeyVal($search, $array) { $results = array(); // search for string in each column foreach ($array as $idx => $obj) { foreach ($obj as $key => $value) { if (stripos($value, $search) !== false) { array_push($results, $obj); break; } } } return $results; } print_r(searchArrayKeyVal('charles', $array)); print_r(searchArrayKeyVal('wild', $array));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [title] => Great Expectations [author] => Charles Dickens ) [1] => Array ( [title] => The Voyage of the Beatle [author] => Charles Darwin ) ) Array ( [0] => Array ( [title] => The Call of the Wild [author] => Jack London ) )

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:
18.73 ms | 402 KiB | 8 Q