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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strip Letters from Variable 1

Status
Not open for further replies.

RENO9

Technical User
Dec 8, 2005
27
GB
I have variables pulled from a db which are similar to,
SA1
SA2
SA3
i am trying to remove the SA from the variable so im just left with 1,2 etc

Ive had a look at trim and split but unable to find a relevant example.

Are those the correct methods to go about it and if so how?

Thanks
 
Take a look at the [blue]substr()[/blue] I think it might do what you want.




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
or str_replace() (replace "SA" with an empty string)
 
Thanks for the quick replies,

i got it sorted with,

$replace = str_replace("SA", "", $OldQuestionNumber);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top