如果Array包含在PHP中

Phi*_*ide 0 php arrays search

我创造了一系列城市

$cities = explode("|", $city);
Run Code Online (Sandbox Code Playgroud)

现在我想搜索该数组以查看它是否包含if语句的特定城市.像这样......

If($cities includes(London)){
    Do code;
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

rab*_*dde 7

if (in_array('London', $cities)) {
    [...]
}
Run Code Online (Sandbox Code Playgroud)