Using the following code that I already have:
$var = "City 0.428371 2 BEIJING Beijing 39.91388888888889 116.39166666666667 Organization 0.392154 1 PBOC PBOC Motorsports Club Company 0.38134 1";
Need to extract this:
City 0.428371 2 BEIJING
Using the following code that I already have:
$var = "City 0.428371 2 BEIJING Beijing 39.91388888888889 116.39166666666667 Organization 0.392154 1 PBOC PBOC Motorsports Club Company 0.38134 1";
Need to extract this:
City 0.428371 2 BEIJING
$extracted = implode(' ', array_slice(explode(' ', $var), 0, 4));
Bejing has to be one word, wouldn't work with "New York" for example.