3v4l.org

run code in 300+ PHP versions simultaneously
<?php $id=5; $allProducts[] = array('itemid'=>$id,'qty' => 1); $allProducts[] = array('itemid'=>6,'qty' => 1); // old version if(array_search($id,array_column($allProducts, 'itemid'))) { echo "an item was found\n"; // will not work } else { echo "NO Item was found, though it should be there\n"; } // corrected version if(array_search($id,array_column($allProducts, 'itemid')) !== false) { echo "an item was found and has the key " .array_search($id,array_column($allProducts, 'itemid')); }
Output for git.master, git.master_jit, rfc.property-hooks
NO Item was found, though it should be there an item was found and has the key 0

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