Blog

Core PHP for Beginners

 Introduction:

PHP is one of the easiest and most comfortable frameworks, which can link with the Mysql database.First of all, we have to study the basic structure, format, functionality of the framework.PHP is only for backend purpose, for the frontend (.i.e.,) UI we use HTML basically.For the better UI, you should learn basic HTML, CSS, JavaScript.

Installing:

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.

Sample Program:

  • 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.

<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo “Hello World!”;
?>

</body>
</html>

Execution:

  • Open the web browser.
  • enter the URL as localhost/Myfirst.php.
  • The output looks like as shown in the figure.

PHP  Variables:

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.

For ex:$i=0;

The variable $i will hold the value 0.

 

 

That’s all for today .thank you

 

Leave a Reply

Your email address will not be published.