How to intercept a php string? suppose there is a string $ addr = 'lanzhou telecom of Gansu province '. I want to retrieve the province and city information $ p = 'gansu province' $ c = 'lanzhou city '. how can I perform this operation? retrieve? Note: how can I intercept a $ p & nbsp ;=& nbsp; strstr ($ addr, & nbsp; 'save', true php string?
Assume there is a string
$ Addr = 'gansu Lanzhou telecom'
I want to retrieve the province and city information.
$ P = 'gansu province'
$ C = 'lanzhou'
How can I retrieve it?
Note: I am using $ p = strstr ($ addr, 'offset', true); the system prompts no third parameter.
Is there any other way to obtain
------ Solution --------------------
$ Addr = 'lanzhou Telecom, Gansu province ';
Preg_match_all ('/. +? (? : Province
------ Solution --------------------
City)/', $ addr, $ r );
List ($ p, $ c) = $ r [0];
Echo $ p;
Echo $ c;