3v4l.org

run code in 300+ PHP versions simultaneously
<?php $inputArray = array('first-key' => 'first value', 'second-key' => 'second value', array('foo-1' => 'val', 'bar'=> 'value', 'foo-2' => 'val2'), array('soup' => 'carrots', 'fruit' => 'banana') ); $outputArray = array_filter( $inputArray, function ($element) { return ! is_array($element) || ! empty( array_filter($element, function($key) { return strpos($key, 'foo-') === 0; }, ARRAY_FILTER_USE_KEY) ); } ); var_dump($outputArray);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["first-key"]=> string(11) "first value" ["second-key"]=> string(12) "second value" [0]=> array(3) { ["foo-1"]=> string(3) "val" ["bar"]=> string(5) "value" ["foo-2"]=> string(4) "val2" } }

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