3v4l.org

run code in 300+ PHP versions simultaneously
<?php $carts = array( 'Olivia' => array(51, 3, 2), 'Harry' => array(312, 314, 10), 'Charlie' => array(1, 314, 626) ); $fruits = array( 'Apple' => array('id' => 1), 'Banana' => array('id' => 2), 'Peach' => array('id' => 3) ); $fru = array_map(function($item){return $item['id'];}, $fruits); foreach ($carts as $cart) { $find = array_intersect($cart, $fru); if (count($find)){ $result = implode(", ", array_map(function($item) use($fru){ return array_search($item, $fru); }, $find)); echo "Fruit ({$result})\n"; } else echo "No Fruit \n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Fruit (Peach, Banana) No Fruit Fruit (Apple)

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:
19.7 ms | 401 KiB | 8 Q