3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("1" => "0", "2" => "5", "5" => "7", "1C" => "0", "2C" => "5", "5C" => "10", "1S" => "15", "5S" => "20"); $keyContainsC = []; array_walk($array, function ($value, $key) use (&$keyContainsC) { if (strpos($key, 'C') !== false) $keyContainsC[$key] = $value; }); print_r($keyContainsC); array_walk($array, function ($value, $key) use (&$result) { if (strpos($key, 'C') !== false) $result['C'][$key] = $value; if (strpos($key, 'S') !== false) $result['S'][$key] = $value; if (strpos($key, 'C') === false && strpos($key, 'S') === false) $result['NR'][$key] = $value; }); print_r($result['S']);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [1C] => 0 [2C] => 5 [5C] => 10 ) Array ( [1S] => 15 [5S] => 20 )

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:
111.8 ms | 405 KiB | 5 Q