> Hello, I'd like to check for a character at the end of a string, if it
> exists remove it, example:
>
> Looking for - Z
> In string - StringZ
> Result would be - String
>
> -or-
> Looking for - Z
> In string - StringZzz
> Result would be - StringZzz (no change)

if($str{strlen($str)-1}=='Z') $str = substr($str,0,-1);

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to