3v4l.org

run code in 300+ PHP versions simultaneously
<?php $categories = array('Movie'); $reviews = array( array('category' => 'Movie'), array('category' => 'Movie'), array('category' => 'Movie'), array('category' => 'Movie'), array('category' => 'Game') ); print_r($reviews); $filtered = array_filter($reviews, function($review) { return in_array($review['category'], $categories); }); print_r($filtered);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [category] => Movie ) [1] => Array ( [category] => Movie ) [2] => Array ( [category] => Movie ) [3] => Array ( [category] => Movie ) [4] => Array ( [category] => Game ) ) Warning: Undefined variable $categories in /in/WDnCP on line 16 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/WDnCP:16 Stack trace: #0 /in/WDnCP(16): in_array('Movie', NULL) #1 [internal function]: {closure}(Array) #2 /in/WDnCP(15): array_filter(Array, Object(Closure)) #3 {main} thrown in /in/WDnCP on line 16
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:
38.73 ms | 402 KiB | 8 Q