I have two PHP arrays, $array1 and $array2:
$array1 = [55, 23, 45, 6, 0, 12];
$array2 = ['Apple', 'Oranges', 'Pears', 'Banana', 'Mango', 'Cherry'];
Is there a way to ensure that where there is a 0 in $array1 it is deleted and a new $array3 is formed with the 0 omitted. Secondly, the corresponding index value of $array2 is also deleted and a new $array4 is created with 'Mango' omitted, in this example.
Thus, $array3 and $array4 would be:
$array3 = [55, 23, 45, 6, 12];
$array4 = ['Apple', 'Oranges', 'Pears', 'Banana', 'Cherry'];
The important point here is that two new arrays are of equal length and maintain their corresponding indexes, if that makes sense.