[PHP] isset doesn't like -?

2002-11-10 Thread UberGoober
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 `')'' 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.

Is this proper behavior for isset, or is this a php bug? I can't search
google groups for -, or any other search engine for that matter. So it
has been tough trying to see if anyone else gets this error.

Many thanks!

--Brian

PS: what is the proper term for the - syntax? pointer?



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




RE: [PHP] isset doesn't like -?

2002-11-10 Thread John W. Holmes
 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 `')'' 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... 



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




Re: [PHP] isset doesn't like -?

2002-11-10 Thread UberGoober

 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...

That actually makes sense once I thought about it, a function referencing a
variable, or reference to a variable is in no way the same as a variable.

Thanks!



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




Re: [PHP] isset doesn't like -?

2002-11-10 Thread Michael Sims
On Sun, 10 Nov 2002 18:34:52 -0600, you wrote:

PS: what is the proper term for the - syntax? pointer?

In Perl it's called an infix operator.  I think in PHP the technical
term for it is that - thingy... :-)

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