Re: slicing and dicing strings
| From: | Curtis Maurand | Date: | Thu, 28 Jun 2012 12:07:18 +0000 |
| Subject: | Re: slicing and dicing strings | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318325@lists.php.net to get a copy of this message | ||
he answer to his question is:
print(substr($string, 0,
strlen - 1));
http://www.php.net/manual/en/book.strings.php
Cheers,
Curtis
Stuart Dallas wrote:
> WARNING: May contain traces of sarcasm.
>
> On 27
Jun 2012, at 23:15, Kirk Bailey wrote:
>
>> ok, it
slices and dices, but how?
>> in python, to print all but the
last char in string FOO, we say
>> print FOO[:-1]
>>
But this seems to bark like a basset hound in php. Whyfore?
>
> Because it's not valid syntax in PHP.
>
>> Now
tihs tyro is seeking sage words to help me understand this.
>>
RTFM is not sage words; if you don't want to help me please don't waste
>> the bandwidth.
>
> RTFM is the best response
to such a simple request. Seriously, how hard is
> it to do this:
http://bit.ly/MUDL80? This list is here to help you solve
>
problems, not laziness.
>
>> Would anyone care to help
me understand this without dedicating 4
>> precious and in over
demand/under supply hours to RTFM?
>
> If it would really
take you 4 hours to find this out via the manual or
> Google then
I think it would be 4 hours well spent: 3 hours 55 minutes
>
learning how to use the manual / Google effectively, and 5 minutes to
then
> get the answer you seek.
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
>
http://3ft9.com/