I have a string like this, which I need to extract the address from:
$string="xyz company 7 th floor hotel yyyy 88 main Road mumbai 400000 this is sample comapny address 9456 and some other";
$word=str_word_count($string,1,'0...9');
Now word has each word like word[0]=xyz, word[1]=company, word[2]=7, etc.
I need to compare each value. If the word is a number then I want to save it in a temp variable until I get another number.
For example word[2] is 7, so I need to save the values from then until 88 in a temp variable. So the temp should contain "7 th floor hotel yyyy 88".
If the temp variable has fewer than 25 characters then we compare until we get another number. So here we need to keep going from 88 to 400000 and append that to the temp variable.
The temp should finally look like this: "7 th floor hotel yyyy 88 main Road mumbai 400000"
Any help please?