<?php
$my_name = "vn4000";
if ( $my_name == "vn4000" ) {
echo "Your name is vn4000!<br />";
}
echo "Welcome to my homepage!";
?>
- We first set the variable $my_name equal to "vn4000".
- We next used a PHP if statement to check if the value contained in the variable $my_name was equal to "vn4000"
- The comparison between $my_name and "vn4000" was done with a double equal sign "==", not a single equals"="! A single equals is for assigning a value to a variable, while a double equals is for checking if things are equal.
- Translated into english the PHP statement ( $my_name == "vn4000" ) is ( $my_name is equal to "vn4000" ).
- $my_name is indeed equal to "vn4000" so the echo statement is executed.