Reply to Re: deleting the end of a string

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация