View Single Post
Old 01-19-2013, 06:35 PM   PM User | #1
jeddi
Senior Coder

 
Join Date: May 2006
Posts: 1,517
Thanks: 26
Thanked 4 Times in 4 Posts
jeddi has a little shameless behaviour in the past
Extracting a number from a string ??

Hi,

I have a string like this:

"villarentfethiye.example.com/18-vacationvillatrekkingturkey"

The bold element "example.com/" will stay constant and so will the "-" (dash or hyphen )
immediately after the number. The other stuff can change a lot.


I need to extract the number. In this case it is 18

What would you say is the most efficient way to extract this using php ?
I will use the number to find the record by it's id number in the db table.

Many thanks.



.
__________________
If you want to attract and keep more clients, then offer great customer support.

Support-Focus.com. automates the process and gives you a trust seal to place on your website.
I recommend that you at least take the 30 day free trial.

Last edited by jeddi; 01-19-2013 at 06:46 PM..
jeddi is offline   Reply With Quote