PHP ==

PHP = and PHP ==

The PHP '=' equal sign is commonly used to create variables and arrays. Asides from that, you will you often encounter the '==' equal sign which is often used in statements and to compare values. If you ever receive an error with unexpected '=', you should check for the mispelling. A tip to avoid errors is to use a good PHP IDE like PHPStorm. These editors are smart and they can find errros that you can change before you even test the script in your browser.

Anyways, the example below shows an error. It also shows code that causes the error and how to fix it.

Parse error: syntax error, unexpected '=' in /home/user/public_html/folder/file.php on line 98

The error above is the impropper usage of a '=' sign. One such error could be in an if statement when '=' should have been '=='.

For example:

if($var=22) {do this}

should be

if($var==22) {do this}