I used the explode function and i’d like to do a test in order to know when the value of the table 1 is on the same index that the value of the table 2.
Example:
$pizza1 = "piece1 piece2 piece3 piece4 piece5 piece6";
$piecesA = explode(" ", $pizza1);
$pizza2 = "piece7 piece8 piece9 piece10 piece11 piece12";
$piecesB = explode(" ", $pizza2);
I can compare the values but not the position: I don’t know how can I say within the foreach this: if the two values are in the same position (index) return true…
for example: piece1 and piece7 are in the same index. (the index 0 of each table)
Can you please explain me how can I do this?
Thanks.
1 Answer