Page 1 of 1

[SOLVED ] str_replace

Posted: Tue Sep 07, 2004 6:47 pm
by ol4pr0
i wanted to replace the following

lets say string looks like this

/word/number/number.doc

this should become

number.doc

the first i dont have troubles with.
the first number i do.. since this is not always the same
i tried replacing /%/ and /*/ neither of them seemed to work.

Posted: Tue Sep 07, 2004 6:51 pm
by qads
dont need replace.

Code: Select all

<?php
$string = "/word/number/number.doc";
$array = explode("/", $string);
$string = $array[sizeof($array)-1];
?>

Posted: Tue Sep 07, 2004 6:57 pm
by ol4pr0
Thanks alot.