Please Wait For Loading

What is Php (Hypertext Preprocessor)

PHP is Associate in Nursing ASCII document, taken, and object-oriented scripting language which can be dead at the server-side. PHP is analogous temperament for internet development. Therefore, it’s used to develop internet applications (an application that executes on the server and generates the dynamic page.).PHP was created by Rasmus Lerdorf in 1994 but appeared among the market in 1995.PHP 8.2.0 is that the newest version of PHP, that was free on  2022-12-08

PHP stands for electronic text Preprocessor.
PHP is Associate in Nursing taken language, i.e., there isn’t any would really like for compilation.
PHP is faster than completely different scripting languages, as AN example, ASP and JSP.
PHP could also be a server-side scripting language, that’s utilized to manage the dynamic content of the online website.
PHP could also be embedded into machine-readable text nomenclature.
PHP is Associate in Nursing object-oriented language.
PHP is Associate in Nursing ASCII document scripting language.
PHP is easy and simple to be told language.

Feature of PHP

Why use PHP

PHP could be a server-side scripting language, that is employed to style the dynamic internet applications with MySQL info.

It handles dynamic content, info likewise as session following for the web site.
You can produce sessions in PHP.
It will access cookies variable and conjointly set cookies.
It helps to write the information and apply validation.
PHP supports many protocols like communications protocol, POP3, SNMP, LDAP, IMAP, and plenty of a lot of.
Using PHP language, you’ll be able to management the user to access some pages of your web site.
As PHP is simple to put in and started, this is often the most reason why PHP is that the best language to be told.
PHP will handle the forms, like – collect the information from users victimization forms, reserve it into the info, and come back helpful data to the user. For example – Registration type.

Basic PHP Syntax

 


A PHP script can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>:

<?php
// PHP code goes here
?>

The default file extension for PHP files is “.php”.

A PHP file normally contains HTML tags, and some PHP scripting code.

Hello World Program

<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

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


</body>
</html>

How to Run php code in XAMP

Step 1: Create a simple PHP program like hello world.

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

Step 2:-Save the file with first.php name in the htdocs folder, which resides inside the xampp folder.

Step 3: Run the XAMPP server and start the Apache and MySQL.

Step 4: open the web browser and type localhost http://localhost/first.php on your browser window.

Step 5: The output for the above first.php program will be shown as the screenshot below: