<?php
$s = array("z","z","E","z","z","E","E","E","E","E");
$b = array("a","a","a","z","a","E","E","E","a","E");
foreach($s as $k => $v) {
if($b[$k] === $s[$k]) {
echo $k . ' is the index where keys and values exactly match with value as ' . $b[$k];
echo "\n";
}
}
3 is the index where keys and values exactly match with value as z
5 is the index where keys and values exactly match with value as E
6 is the index where keys and values exactly match with value as E
7 is the index where keys and values exactly match with value as E
9 is the index where keys and values exactly match with value as E
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
3 is the index where keys and values exactly match with value as z
5 is the index where keys and values exactly match with value as E
6 is the index where keys and values exactly match with value as E
7 is the index where keys and values exactly match with value as E
9 is the index where keys and values exactly match with value as E