Install a web server which supports PHP and Mysql.If you want to try it on a local server, then install XAMPP.It acts as a local server.After installing it go to Xampp control panel and then click the start button Apache and Mysql.It enables the local server.
For coding use any text editor and save the file as .php.
- Lets just print some static content.
- PHP content should be written inside the php tag <?php ……….?>.
- Every line of the php should end with semicolon(;).
- Then save it with the PHP extension.
- PHP is not case sensitive.
- You have to save it in the xampp/htdocs/Myfirst.php to run it using the local server.
<h1>My first PHP page</h1>
echo “Hello World!”;
- Open the web browser.
- enter the URL as localhost/Myfirst.php.
- The output looks like as shown in the figure.
PHP variables should be declared using the dollar ($) symbol.It’s so simple than other programming languages where they should declare it using some int, char etc., based on the type of the data to be stored in that variable.But here there is no such complexity, we can simply declare a variable with a $ symbol at the starting.
The variable $i will hold the value 0.
That’s all for today .thank you