I have a multidimensional array. The code below outputs one entire column.
<?php
for ( $row = 1; $row <$arrCSV; $row++ ) {
echo ''.$arrCSV[$row]['6'].'';
}
?>
How would I put an “IF” statement to only display the rows the have “CAT” in “$arrCSV[$row][‘4’]”
I am not sure if it is an IF statement?
strpos()is the best function for determining if a particular substring exists (EDITED according to comments below):I have changed the
forloop to aforeachbecause for this particular task, it is less confusing and more readable.