3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 0 => "4", 1 => "8", 2 => "15", 3 => "16", 4 => "23", 5 => "42", 6 => "apple", 7 => "water" ); $ints = array_filter($arr, 'is_numeric'); $strs = array_filter($arr, function($v){ return !is_numeric($v); }, ARRAY_FILTER_USE_KEY); $strs = array_filter($arr, function($v, $k){ return !is_numeric($v); }, ARRAY_FILTER_USE_KEY); echo '<pre>'; print_r($ints); print_r($strs); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/evPYv:14 Stack trace: #0 [internal function]: {closure}(0) #1 /in/evPYv(14): array_filter(Array, Object(Closure), 2) #2 {main} thrown in /in/evPYv on line 14
Process exited with code 255.

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