|
Posted by Oli Filth on 10/13/43 11:35
jukka said the following on 24/12/2005 21:25:
> Oli Filth wrote:
>
>> mcyi2mr3@lycos.co.uk said the following on 24/12/2005 15:32:
>>
>>> Hi all!
>>>
>>> Is it possible to delete the last 3 characters in a string?
>>>
>>
>> Yes.
>>
>> http://php.net/substr
>>
> err...i meant to actually answer the question ;D
> here:
>
> $string = "abcdefg";
> $length = strlen($string) - 3;
> $newstring = substr($string, 0, $length);
> print $newstring; //returns abcd
Or to save typing:
$newString = substr($string, 0, -3);
--
Oli
Navigation:
[Reply to this message]
|