Doesn't substr($a, -1) work ?

--Wez.

On Sun, 31 Oct 2004 17:45:03 -0500, Greg Beaver <[EMAIL PROTECTED]> wrote:
> It would reduce the errors I inevitably get
> whenever using a complex feature like substr().  The three choices:
> 
> 1) substr($a, strlen($a) - 1);
> 2) $a{strlen($a) - 1}
> 3) $a{-1}
> 
> It's pretty obvious that the 3rd choice lowers the potential for all
> kinds of bugs (mistypign, wrong parameter name, incorrect parameter
> placement), and is much more readable.  For those who already know how
> {} works in PHP, it's also obvious what it does at the first look
> without any speculation.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to