3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 'abc' => 46, 'def' => 134, 'xyz' => 34, //'qwe' => 39, ]; $array2 = [ 'abc' => 46, 'def' => 134, 'xyz' => 34, 'qwe' => 39, ]; function allKeysFoundInBothArrays(array $array1, array $array2): bool { foreach ($array1 as $key => $notUsed) { echo "checking $key in \$array2\n"; if (!key_exists($key, $array2)) { return false; } unset($array2[$key]); } foreach ($array2 as $key => $notUsed) { echo "checking $key in \$array1\n"; if (!key_exists($key, $array1)) { return false; } } return true; } var_export(allKeysFoundInBothArrays($array1, $array2));
Output for git.master, git.master_jit, rfc.property-hooks
checking abc in $array2 checking def in $array2 checking xyz in $array2 checking qwe in $array1 false

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:
39.67 ms | 405 KiB | 5 Q