Page 1 of 1

[Solved] Removing the end of a string

Posted: Wed Feb 23, 2005 12:48 pm
by jimbo
sorry guys, last one for today, promise!

String one: "billybobjoeisthecoolestguyever"
String two: "isthecoolestguyever"
Desired String: "billybobjoe"

I know that the desired string will be the first string minus the second string.
does anyone know how to remove the second string from the end of the first?

Posted: Wed Feb 23, 2005 12:52 pm
by patrikG
substr() does all the work.

Posted: Wed Feb 23, 2005 12:55 pm
by jimbo
substr requires the length to be truncaded. how can I get the length of the second string?

I need a function that gives me the length of $stringtwo

Posted: Wed Feb 23, 2005 12:57 pm
by feyd
hmmm strlen() maybe? :roll:

Posted: Wed Feb 23, 2005 12:58 pm
by jimbo
thanks guys,

[topic solved]

Posted: Wed Feb 23, 2005 12:59 pm
by patrikG
Reading the manual is your friend. It is everyone elses who programs PHP.