On Wed, Jun 27, 2012 at 6:15 PM, Kirk Bailey <kbai...@howlermonkey.net> 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?

    It is a longer syntax which, in agreement with some folks, I think
could be shortened (there's a feature request you could submit if you
were so inclined), but there's a few methods you could use.  Two of
which are shown below.

$foo = 'This seems to bark like a basset hound in PHP';

echo $foo{(strlen($foo) - 1)};
echo substr($foo,-1);

</Daniel P. Brown>
Network Infrastructure Manager

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to