Help, What's the meaning of this Parse error??
Can somebody please help me? What's the meaning of this Parse error?
The Parse error reads: syntax error, unexpected T_IF in /home/shoutout/public_html/thumb/class.php on line 1043 Below are lines 1042,1043 and 1044. { $GIFtemp = if ($this->getimagesizeinfo[2] == 1); $ImageCreateFunction = ($GIFtemp ? 'ImageCreateFromGIF' : 'ImageCreateFromPNG'); Thank you, Jay |
You can't have an if() statement with a semicolon after it. You should have something like this:
Code:
if($this->getimagesizeinfo[2] == 1) { |
Quote:
|
yes, Perl/PHP (PHP is a subset of Perl)
in other languages you can run one statement without using {} however in Perl/PHP this is not allowed you need the {} or you will get an error |
It's valid php. For instance, this works:
Code:
if(true); Code:
$GIFtemp = $this->getimagesizeinfo[2] == 1 |
Quote:
|
Hi -
I_grok is right: Code:
// Permissible (but weird) in C/C++, but it's a parse error in PHP Code:
// Correct in PHP ... clearer in any language http://www.devarticles.com/c/a/PHP/M...-PHP-Errors/1/ 'Hope that helps .. PSM |
Quote:
The major differences PHP is made directly for web page scripting where as Perl script is used more generically and not only for web pages. Although there are obvious differences, Perl has web extensions in CPAN that make PHP and Perl scripts very similar. |
Thank you everyone for trying to help me. I tried to fix the code myself but I kept getting other parse errors. I'm a total dummy with these codes.
The error was on line 1043 after fixing the code according to everyones input I started getting an error on line 1700. Would anyone like to check it out and let me know what I need to do? I really appreciate all the help. Jay |
Here's the next erro:
Parse error: syntax error, unexpected ':' in /home/shoutout/public_html/thumb/class.php on line 1700 Line 1700: $dither = (0 < strlen ($dither) ? : true); |
Please look back at my previous link - it's the same problem:
http://www.linuxquestions.org/questi...80#post2443080 1. As far as the real problem: You do NOT want to create boolean expressions like "$dither = (0 < strlen ($dither) ? : true);" if you can do the same thing with a conditional like "if (strlen ($dither) > 0) {...}" 2. As far as whether or not you need "{}": No, you don't. The problem isn't braces, the problem is trying to use a boolean expression instead of just using a simple "if/then/else". 3. As far as the relationship between Perl and PHP: The answer is ultimately a matter of taste. Sure, they're both "C-like". And sure, they're both scripting languages. But they were written by different people, for different purposes, run in different environments, and have different strengths and weaknesses. Personally, I think the two are more dissimilar than not. 'Hope that helps .. PSM |
Quote:
I don't think so man. Except for trivial syntax similarities they are completely unrelated. |
All times are GMT -5. The time now is 11:53 PM. |