I have 2 arrays:
$arr1 = array('Test', 'Hello', 'World', 'Foo', 'Bar1', 'Bar'); and $arr2 = array('hello', 'Else', 'World', 'Tes', 'foo', 'BaR1', 'Bar');
I need to compare 2 arrays and save the position of the corresponding elements in the 3rd array $arr3 = (3, 0, 2, 4, 5, 6); //expected result, displaying position of matching element of $arr1 in $arr2. $arr3 = (3, 0, 2, 4, 5, 6); //expected result, displaying position of matching element of $arr1 in $arr2.
By “matching” I mean all elements that are identical (for example, World) or partially the same (for example, Test and Tes), as well as those elements that are the same but are in another case (for example, Foo and foo, Bar and bar )
I tried a number of combinations and various functions without success, using functions such as array_intersect(), substr_compare(), array_filter() and much more. I am not asking for an exact solution, just something that will help me on the right path, because I have been circling all day.