Fix if statement to use equal to operator instead of assignment operator. (#24520)

Fix if statement to use Double equals (==)  instead of Single equal  (=) which would overwrite the value of $_GET['name'] variable.
This commit is contained in:
Dhiraj Kanchan
2019-08-14 20:58:23 +05:30
committed by Randell Dawson
parent 7ada4e8de2
commit e1c9a647df

View File

@ -10,7 +10,7 @@ Condicionais em PHP são escritos usando o `if` , `elseif` , `else` sintaxe. O u
```PHP ```PHP
<?php <?php
if ($_GET['name'] = "freecodecamp"){ if ($_GET['name'] == "freecodecamp"){
echo "You viewed the freeCodeCamp Page!"; echo "You viewed the freeCodeCamp Page!";
} }
``` ```
@ -19,9 +19,9 @@ Condicionais em PHP são escritos usando o `if` , `elseif` , `else` sintaxe. O u
```PHP ```PHP
<?php <?php
if ($_GET['name'] = "freecodecamp"){ if ($_GET['name'] == "freecodecamp"){
echo "You viewed the freeCodeCamp Page!"; echo "You viewed the freeCodeCamp Page!";
} elseif ($_GET['name'] = "freecodecampguide"){ } elseif ($_GET['name'] == "freecodecampguide"){
echo "You viewed the freeCodeCamp Guide Page!"; echo "You viewed the freeCodeCamp Guide Page!";
} }
``` ```
@ -30,9 +30,9 @@ Condicionais em PHP são escritos usando o `if` , `elseif` , `else` sintaxe. O u
```PHP ```PHP
<?php <?php
if ($_GET['name'] = "freecodecamp"){ if ($_GET['name'] == "freecodecamp"){
echo "You viewed the freeCodeCamp Page!"; echo "You viewed the freeCodeCamp Page!";
} elseif ($_GET['name'] = "freecodecampguide"){ } elseif ($_GET['name'] == "freecodecampguide"){
echo "You viewed the freeCodeCamp Guide Page!"; echo "You viewed the freeCodeCamp Guide Page!";
} else { } else {
echo "You viewed a page that does not exist yet!"; echo "You viewed a page that does not exist yet!";