hi !
i'm starting with php and i would like do a simple function (must work with php3). If the String contains a specific char '|' then it return all after this char without it. If this String doesn't contain this char, all the String is return.
I tried this code but it doesn't work !
<?
function filter($titre){
$delimiteur=("|");
$index=strrpos($titre, $delimiteur);
if(is_string($index) && !$index){
return($titre);
} else {
return(substr(strstr($titre,$delimiteur), 1));
}
}
?>
<?
print(filter("1|title1"));
print(filter("2|title2"));
print(filter("title3")); // without char |
?>
I found the (is_string($index) && !$index) code in a tutorial but i think it doesn't work...
Do you have the solution ?
Thanks,
Eric