PHP is short form of Hypertext Preprocessor.
PHP was Created in 1994 by Rasmus Lerdorf
To start with PHP one should need few things that are as follows:
• basic knowledge of programming / scripting.
PHP Syntax:
1 2 3 | <?php //php codes ?> |
Save your file by naming the file of “.php” extension.
PHP in html can be used inside <?php ?> php tag.
The simple starting example for PHP we can use as:
As above seen php script is placed in side <?php and ?>
The php code can insert any where in HTML Document.
Our First php example code is below.
php hello world code is below.
1 2 3 4 5 6 7 8 9 | <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo "Hello World"; ?> </body> </html> |
Result:
Hello World
We can also use html in PHP like embeddin HTML tags in PHP as below
1 2 3 4 5 6 7 8 9 | <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo "PHP stands for <br/> Hyper Text preprocessor"; ?> </body> </html> |
In echo a <br/> HTML tag is used.