<?php
$mlbCities = array(
'Carolina',
'Atlanta',
'New Orleans',
'Philadelphia',
'St. Louis',
'Washington',
'Houston',
'Tennessee',
'New England',
'NY Jets',
'Cincinnati',
'Green Bay',
'Arizona',
'Jacksonville',
'Oakland',
'Kansas City',
'Minnesota',
'Detroit',
'Tampa Bay',
'Buffalo',
'Seattle',
'San Francisco',
'Pittsburgh',
'Chicago',
'Baltimore',
'San Diego',
'Cleveland',
'Denver',
'NY Giants',
'Dallas',
'Indianapolis',
'Miami'
);
$string = 'San Francisco Giants';
foreach($mlbCities as $city) {
$index = strrpos( $string, $city );
var_dump($index);
if(!empty($index)) {
print "yay";
} else {
print "nay";
}
}
?>
preferences:
43.93 ms | 402 KiB | 5 Q