3v4l.org

run code in 300+ PHP versions simultaneously
<?php function searchNested($arr,$keyword){ $found = array(); foreach($arr as $item){ if($item['categorySlug']==$keyword){ $found[] = $item; }else{ $found = array_merge($found,__FUNC__($item['categoryNested'],$keyword)); } } return $found; } var_dump(searchNested(array(array ( 'categoryName' => 'Moto', 'categoryTitle' => 'Moto', 'categorySlug' => 'moto-and-tech', 'categoryAttr' => array ( 0 => 'test1', 1 => 'test2', 2 => 'test3', 3 => 'test4' ), 'categoryNested' => array ( 0 => array ( 'categoryName' => 'anything', 'categoryTitle' => 'anything', 'categorySlug' => 'anything', 'categoryAttr' => array ( 0 => 'test1', 1 => 'test1', 2 => 'test1', 3 => 'test1' ), 'categoryNested' => array() ), 1 => array ( 'categoryName' => 'any', 'categoryTitle' => 'any', 'categorySlug' => 'any', 'categoryAttr' => array ( 0 => 'test1', 1 => 'test1', 2 => 'test1', 3 => 'test1' ), 'categoryNested' => array() )))),'any'));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function __FUNC__() in /in/MXRfh:8 Stack trace: #0 /in/MXRfh(14): searchNested(Array, 'any') #1 {main} thrown in /in/MXRfh on line 8
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:
51.49 ms | 401 KiB | 8 Q