Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the numeric bit of a string...

Status
Not open for further replies.

SgtBadass

MIS
Jul 16, 2002
19
GB
I've got a bunch of strings like this:

style01_11.png
style143_12.png

etc,

How can I get the numeric bit attached to the word 'style'?

I've already exploded it into an array, so they now read:

style01
style143

But now I'm stuck on getting just the number.
 
If they all begin with the style you can just strip the first four letters via substr() or str_replace(). If not, we would need more information to be able to help you.
 
Yup - I stripped 'em out, I thought there might be a function that would just extract the number, but subbing it was just as easy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top