Re: Parse error: Needs T_VARIABLE or $

From: Date: Sat, 30 Jun 2001 14:13:24 +0000
Subject: Re: Parse error: Needs T_VARIABLE or $
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55651@lists.php.net to get a copy of this message
Try this: $r = trim($rowData[3]); if ( !empty( $r ) ) { $tdStr.= trim($rowData[3]); } I tokk a look at the manual: 1. Note: empty() is a language construct. so: !empty is like to say !if or !while : so it's wrong- 2. 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. ----- Original Message ----- From: "Jason Lustig" <lustig@acsu.buffalo.edu> To: "Php-General@Lists. Php. Net" <php-general@lists.php.net> Sent: Friday, June 29, 2001 11:55 PM Subject: [PHP] Parse error: Needs T_VARIABLE or $ > This is really weird. Very, very, very weird. I have the following code in a > script: > > if (!empty(trim($rowData[3]))) > { > $tdStr.= trim($rowData[3]); > } > > > Now, when I run it, I get the following error: > > > Parse error: parse error, expecting T_VARIABLE' or > '$'' in > c:\server\wwwroot\contributors.php on line 70 > > (note: line 70 is the first liine of the code snippet above) > > Now, this shouldn't be a problem. There is no problem with the parens, and I > don't see anything wrong with the code. Can someone help me out with this? > This is happening in another script (when I use the empty() function) and it > is really weird... > > --Jason > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#55651) next »