Basic PHP Steps :
The code itself suits proper internal a page’s HTML, and prefer HTML it's far made up of Undeniable(Plain) ol’ Textual Content. So a web page that presentations the phrases or words “i am a Angry MAM!” message would take a seat interior or insde an HTML page Named Something.Hypertext PreProcessor(PHP), like this:
Angry Man Example
<font color = "blue">My PHP code makes this page say:</font>
<p> <?php print ("I am the Angry MAN"); ?>
Now you try and See how that works? The HTML is rendered as regular HTML, but everything that is inside the "?php" and "?" tags gets processed as PHP.
Basic Syntax Of PHP
Now Its time to write or create your own first PHP script. The some basic rules of PHP are as follow these:
For you, to Get a PHP Ccript Working, the file it is in or the file that it calls to do the heavy lifting have to lead or end in .Hypertext Preprocessor(php) (in advance variations Used the Document Extensions .PHP3 and .Phtml). Like HTML, your files are saved as Undeniable(PLAN) Textual Content.
Comments For PHP:
It’s important to get within the habit of leaving Notes about your code with the remark or comment tags so that months down the street you can make experience of what you have been trying to make your script do. The manner you set feedback aside from your code (that you don’t need displayed or accomplished) is with both “//” at the start of every line, or surrounded by “/*” and “*/” in case you need to comment out numerous lines:
// This line or Sentence be ignored. Note to self: // Pick up drink, cake, and balloons. print ("I am the Angry MAN"); /* That's, too, will be ignored. Hey, and don't forget the What is your Aim! */
Code Syntax for PHP:
How we Can Start of PHP Code:
In PHP, We will start Every piece of PHP code start with "<?php" else this (or the abbreviated "<?" that's depend on if your sever Configured to hanlde that code).
End of PHP Code:
In PHP,the path to signify that the PHP code to finishid to adding "?>" at the end of your code.
Every Chunk of PHP:
With some exceptions, each separate instruction or practise which you write will end or stop with a semicolon.
Parentheses in PHP:
The basically or typical function looks like this in PHP
… in which “print” is the characteristic or function and the stuff in which the function that works on sits inside the parentheses"()", with a semicolon";" to finish it off. (simply to confuse you, “print” is the exception that still also with out parentheses.) through the way, echo () is the same as print ().
Similar to HTML, the real formatting of your Hypertext Preprocessor(PHP) code (where you put space or areas, line breaks, and so on.) will no longer affect the outcome besides the ones elements of the code that tell a web browser the way to show your page. So this piece of code is .....
print ("I am a Angry MAN");
... Is successfully identical to:
print ("I am a Angry MAN");
Like extra complex HTML, it behooves you to apply white space and tabs on your code to make the code greater comprehensible.