<?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';
foreach($mlbCities as $city) {
var_dump($city);
$team = strpos($string, $city);
if (!empty($team)) {
echo 'Found it\r';
exit;
} else {
echo "Nope\r";
}
}
?>
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- string(8) "Carolina"
Nope
string(7) "Atlanta"
Nope
string(11) "New Orleans"
Nope
string(12) "Philadelphia"
Nope
string(9) "St. Louis"
Nope
string(10) "Washington"
Nope
string(7) "Houston"
Nope
string(9) "Tennessee"
Nope
string(11) "New England"
Nope
string(7) "NY Jets"
Nope
string(10) "Cincinnati"
Nope
string(9) "Green Bay"
Nope
string(7) "Arizona"
Nope
string(12) "Jacksonville"
Nope
string(7) "Oakland"
Nope
string(11) "Kansas City"
Nope
string(9) "Minnesota"
Nope
string(7) "Detroit"
Nope
string(9) "Tampa Bay"
Nope
string(7) "Buffalo"
Nope
string(7) "Seattle"
Nope
string(13) "San Francisco"
Nope
string(10) "Pittsburgh"
Nope
string(7) "Chicago"
Nope
string(9) "Baltimore"
Nope
string(9) "San Diego"
Nope
string(9) "Cleveland"
Nope
string(6) "Denver"
Nope
string(9) "NY Giants"
Nope
string(6) "Dallas"
Nope
string(12) "Indianapolis"
Nope
string(5) "Miami"
Nope
preferences:
230.54 ms | 407 KiB | 339 Q