Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

PHP Equal(=) Sign Errors

When coding with PHP, you often use two symbols for the equal sign. The symbols are ‘==’ and ‘=’. However, they do not mean the same thing. When you declare variables or use mySQL queries, you always use’=’. But, when you use conditions, you must use’==’.

Here is an error that may be displayed when you use the incorrect ‘=’sign.

Parse error: syntax error, unexpected ‘=’ in /home/user/public_html/folder/file.php on line 100

The example below shows a simple error and how to fix it.

if($var=22) { echo "Hello World";}  // code should be should be   if($var==22) { echo "Hello world"; }