mercredi 25 mars 2015

Extracting a part of a string up to a number in PHP

I have various strings of data that I need to extract up to the first number occurance in the string. For example, I may have the following:


John Doe12 Somewhere Lane


Basically I need the part of the string up to the number 1 (John Doe), and then I need the rest of the string (12 Somewhere Lane). The string will not have a space between the name and the street address, so the number of the address will always be right up against the last name. I don't know if this makes a difference but I figured I'd let it be known.


So is there a way to break the string apart like this using PHP?


Aucun commentaire:

Enregistrer un commentaire