RE: [PHP] isset doesn't like "->"?
| From: | John W. Holmes | Date: | Mon, 11 Nov 2002 04:42:59 +0000 |
| Subject: | RE: [PHP] isset doesn't like "->"? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123759@lists.php.net to get a copy of this message | ||
> I don't know if this is a bug, or what, but I get an error when trying
the
> following
>
> if ( isset($adodbobject->Fields('myresult') ) ) { // do something }
>
> PHP throws an error ( not warning ) saying:
> Parse error: parse error, expecting
','' or Ov¿Jf
> Œ‹†Ñ‹ög')'' in
/path/to/index.php
> on
> line 45
>
> However, when I modify the isset to look like this:
>
> $_q = $adodbobject->Fields('myresult');
> if ( isset($_q) ) { // do something }
>
> It works fine.
That's because isset() is expecting a variable, not a function. In your
first example, you're trying to see if a function is set, not a
variable. In your second example, you're doing it right...
---John Holmes...