Date: 04/18/00
- Next message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #4175 Updated: new class_name doesn't work in class definition"
- Previous message: Andrei Zmievski: "Re: [PHP-DEV] Differences in add_index_string()"
- In reply to: dolecek <email protected>: "[PHP-DEV] PHP 4.0 Bug #4173: add function property_exists() please"
- Next in thread: PER4MANCE, J. Dolecek: "Re: [PHP-DEV] PHP 4.0 Bug #4173: add function property_exists() please"
- Reply: PER4MANCE, J. Dolecek: "Re: [PHP-DEV] PHP 4.0 Bug #4173: add function property_exists() please"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 18 Apr 2000, dolecek <email protected> wrote:
> From: dolecek <email protected>
> Operating system: NetBSD (1.4X kernel, 1.4.1 userland)
> PHP version: 4.0 Release Candidate 1
> PHP Bug Type: Feature/Change Request
> Bug description: add function property_exists() please
>
> There are bunch of FOO_exists() functions to check for existence of functions, class methods and such. There is no way to check if an object has given attribute, though.
> It's easy to do in PHP:
>
> # return true if property exists in given object
> # boolean property_exists(Object obj, string name)
> function
> property_exists($obj, $name) {
> $attrs = get_object_vars($obj);
> return isset($attrs[$name]);
> }
>
> but this should be core PHP function.
Why? You can very easily do this:
if (isset($obj->$name)) { .. }
-Andrei
* It's an emergent property of human minds to create. *
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #4175 Updated: new class_name doesn't work in class definition"
- Previous message: Andrei Zmievski: "Re: [PHP-DEV] Differences in add_index_string()"
- In reply to: dolecek <email protected>: "[PHP-DEV] PHP 4.0 Bug #4173: add function property_exists() please"
- Next in thread: PER4MANCE, J. Dolecek: "Re: [PHP-DEV] PHP 4.0 Bug #4173: add function property_exists() please"
- Reply: PER4MANCE, J. Dolecek: "Re: [PHP-DEV] PHP 4.0 Bug #4173: add function property_exists() please"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

