Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: weird parenth error


Message #1 by "Joel Wickard" <jwickard@l...> on Fri, 1 Feb 2002 17:31:51 -0800
Okay -- empty() is a LANGUAGE CONSTRUCTS, not FUNCTION.  It checks to see if
a variable is empty.  If you pass it something which is NOT a variable, it
returns false, because of course a function or its return value is not a
variable.

From the http://www.php.net/empty

Note: empty() is a language construct.
  ...
Note that this is meaningless when used on anything which isn't a variable;
i.e. empty (addslashes ($name)) has no meaning since it would be checking
whether something which isn't a variable is a variable with a FALSE value.


whether or not this is the same case with isset() isn't explicitly said on
the isset() documentation page, but I'm assuming that's the case, since
isset specifically tests to see if a VARIABLE is set.

If you must use empty/isset, you have to assign the return value to a
variable first.

nik


-----Original Message-----
From: Jaun Terblanché [mailto:jterblanche@a...]
Sent: Monday, February 04, 2002 10:57 PM
To: professional php
Subject: [pro_php] Re: weird parenth error


I tend to agree with Joel. I have tested this, and made sure I have all
parentheses right.
It seems as if the object's method call is not allowed in neither "empty"
nor "isset".
_______________________________
Jaun Terblanché
Chief Technology Officer
Aspivia (Pty) Ltd.

e-mail: jterblanche@a... <mailto:jterblanche@a...>

-----Original Message-----
From: Adam Lang [mailto:aalang@r...]
Sent: 04 February 2002 03:54
To: professional php
Subject: [pro_php] Re: weird parenth error


Only thing that comes to mind is that you missed a parentheses on a
preceding line.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Joel Wickard" <jwickard@l...>
To: "professional php" <pro_php@p...>
Sent: Friday, February 01, 2002 8:31 PM
Subject: [pro_php] weird parenth error


> it seems that if I use this statement block:
>
> if(empty($myObject->getParam()))
>
> I get the following error:
>
> Parse error: parse error, expecting `')''
>
> this is an object created on another page, and registered as a session
> variable.  I have the class decleration included before I call
> session_start() so I don't thik I have a problem there.
>
> I know the object is valid, if I ditch the accessor method and just access
> the parameter, it works fine.
>
> anyone have any ideas?
>
>
>









  Return to Index