I am also adding little tips. This is very basic that every php sentence will be ended by a ";". Most beginners make the mistake. They forgot to add a ; sign at the end of the sentence. Another common mistake to the beginner is not to add closing " sign when they use starting " sign. Make me clearer
CODE
echo "This is a tutorial";
This is the valid code, but the common mistakes are not to add closing " sing or ; sign. eg.
CODE
echo "This is a tutorial;
or
CODE
echo "This is a tutorial"
And I also found that few beginners also forget to add "?>" at the end of the php code. They add the starting "<?php" but forget to close it bye adding "?>".
So, the beginners be little careful about the 3 common mistake
1. Omitting closing " sign.
Common mistake
CODE
echo "This is a tutorial;
Correct code
CODE
echo "This is a tutorial";
2. Omitting ; sign
Common mistake
CODE
echo "This is a tutorial"
Correct code
CODE
echo "This is a tutorial";
3. Omitting "?>"
Common mistake
CODE
<?php
echo "This is a tutorial";
Correct code
CODE
<?php
echo "This is a tutorial";
?>
Hope these little tips will help the beginner of php coding.
Reply