php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19064 syntax error with '('s
Submitted: 2002-08-23 05:25 UTC Modified: 2002-08-23 07:10 UTC
From: nery at astalavista dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.1 OS: -
Private report: No CVE-ID: None
 [2002-08-23 05:25 UTC] nery at astalavista dot com
if you try something like this

if(!empty($db->f("bla")))

php says there is an error of syntax

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-23 05:32 UTC] cynic@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.
 [2002-08-23 05:36 UTC] nery at astalavista dot com
it comes this error
Parse error: parse error, unexpected '(', expecting ')'

where as you can see there is no error!
ITS NOT A SUPPORT QUESTION! ITS A PARSE ERROR OF PHP!! DID YOU SEE THAT!?
I am just trying to help
 [2002-08-23 05:39 UTC] derick@php.net
From www.php.net/empty :

 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.

$db->f("bla") is NOT a variable.

Derick
 [2002-08-23 05:59 UTC] nery at astalavista dot com
when I do if ($db->f("bla")!="") it works..
when I do $tmp=$db->f("bla"); if (!empty($tmp)) it works too.

so, first: okz it can looks meaningless to do that but I need to check if what comes over $db->f("bla") has or not an empty content. There are several ways where it works, but the clearest one doesn't. If empty() support or not this parameter I think is a second error, THATS NOT what the compiler says: "parse error, unexpected '(', expecting ')'" . agree?!

second: anyway I still think that since $db->f("bla") returns a value, this value should be checked with empty(). it doesn't make sense you put this value into a variable and after use this variable as a parameter.

And this is my last post, I guess you understand my point, and you can do what you want, or just ignore.
 [2002-08-23 06:22 UTC] msopacua at idg dot nl
<quote>anyway I still think that since $db->f("bla") returns a value</quote>

Value != variable and empty checks a variable.

The variable is the container. You check whether a bottle is empty, not whether milking the cow produces anything.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 06:00:01 2026 UTC