Re: [PHP-DEV] $scalar{index} syntax
yes, whoosp, just found that page. the problem turns out to be that isset($string{n}) is always false with ZE2, and empty($string{n}) is always true. same for $string[n]. it works with ZE1, so i'll just log the bug. (though it does kick out an 'Uninitialized...' notice, which the same test on an array key or object property does not. i sympathize with the bugs that have been logged about that, which have generally been marked Bogus. but that can be suppressed with @, at least, so not a big thing.) On Tue, 10 Dec 2002, Rasmus Lerdorf wrote: You mean $string{2} ? That's the more correct way to do $string[2] to make it clear that it is a character offset. This has been supported for years and will not go away. -Rasmus On Tue, 10 Dec 2002, Brad Bulger wrote: trying to fix bugs in some PEAR code, i noticed the person used a way of getting at the individual characters in a string: $string{2} === substr($string,2,1) is that old syntax or something? is there any reason to expect it to work in future versions? thanks -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] $scalar{index} syntax
On Tue, 10 Dec 2002, Brad Bulger wrote: trying to fix bugs in some PEAR code, i noticed the person used a way of getting at the individual characters in a string: $string{2} === substr($string,2,1) is that old syntax or something? is there any reason to expect it to work in future versions? This is the recommended systax. (over $string[2]). Derick -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] $scalar{index} syntax
trying to fix bugs in some PEAR code, i noticed the person used a way of getting at the individual characters in a string: $string{2} === substr($string,2,1) is that old syntax or something? is there any reason to expect it to work in future versions? thanks -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] $scalar{index} syntax
You mean $string{2} ? That's the more correct way to do $string[2] to make it clear that it is a character offset. This has been supported for years and will not go away. -Rasmus On Tue, 10 Dec 2002, Brad Bulger wrote: trying to fix bugs in some PEAR code, i noticed the person used a way of getting at the individual characters in a string: $string{2} === substr($string,2,1) is that old syntax or something? is there any reason to expect it to work in future versions? thanks -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php