Introduction about PHP [PHP 7]

In this article we are going to cover Introduction about PHP, What is PHP, Why We Use PHP, Features Of PHP, Different ways to Install PHP and PHP Programming Basics.

Introduction about PHP

What is PHP ?

Php is an acronym for “PHP: Hypertext Preprocessor. PHP is a server-side scripting languages.  PHP is an open-source, interpreted, and object-oriented scripting language that can be executed at the server-side. PHP is well suited for web development.

  • PHP stands for Hypertext pre-processor.
  • PHP is an interpreted language
  • PHP is server-side scripting language.
  • PHP is faster than other scripting language.
  • PHP is an object-oriented language.
  • PHP is an open-source scripting language.
  • PHP is easy and simple to learn.

What is PHP File?

  • PHP files can contain text, HTML, CSS, JavaScript and PHP code.
  • PHP code is executed on the server, and the result is returned to the browser as plain HTML
  • PHP files have extension “.php”

Why We Use PHP?

  • PHP runs on various platform.
  • PHP handles dynamic content, which is used to design the dynamic web applications.
  • It helps to encrypt the data and apply validation.
  • You can create session in PHP
  • PHP is free. Download it from the official PHP resource
  • PHP is easy to learn and rules efficiently on the server side.
  • PHP can create, open, read, write, delete, and close files on the server.
  • PHP can collect form data.
  • PHP can add, delete, modify data in your database.
  • PHP can encrypt data.
  • PHP can send and receive cookies.

Features Of PHP:

  • Performance
  • Open-source
  • Familiarity
  • Embedded
  • Platform Independent
  • Database Support
  • Web Servers Support
  • Security
  • Control

Different ways to Install PHP:

  • WAMP for Windows
  • LAMP for Linux
  • MAMP for Mac
  • SAMP for Solaris
  • XAMPP (Cross, Apache, MySQL, PHP, Perl)for Cross Platform)

Once you complete installation open server Control panel and start Apache and MySQL.

PHP Programming Basics:

Full Tags:

<?php
PHP code
?>

Short Tags:

<?
PHP code
?>

Comments in php:

(//): for Single Line
 (/*…*/): for multiple lines

Hello World php program:

<!DOCTYPE html>
<html>
<body>

<h1>Welcome to FOSSTechNix</h1>

<?php
echo "Hello World!";
?>

</body>
</html>

Output:

Introduction about PHP [PHP 7] 1

Note: PHP statements ends with semicolon(;).

Hello World PHP program with Case Sensitivity:

In PHP, keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are not case-sensitive.

Example of Echo in PHP:

<!DOCTYPE html>
<html>
<body>

<?php
ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
?>

</body>
</html>

Output:

Introduction about PHP [PHP 7] 2

Example of color in php (case Sensitivity):

Look at the example below; only the first statement will display the value of the $color variable! This is because $color, $COLOR, and $coLOR are treated as three different variables:

<!DOCTYPE html>
<html>
<body>

<?php
$color = "red";
echo "My dress color is " . $color . "<br>";
echo "My top color is " . $COLOR . "<br>";
echo "My shoes color is " . $coLOR . "<br>";
?>

</body>
</html>

Output:

Introduction about PHP [PHP 7] 3

Conclusion:

We have covered Introduction about php, What is PHP, Why We Use PHP, Features Of PHP, Different ways to Install PHP and PHP Programming Basics.

Related Articles:

How To Install PHP 7 On Ubuntu 18.04/16.04 LTS

How to Install Laravel on Ubuntu 20.04/18.04 LTS

How to Install PHP on Ubuntu 20.04 LTS

How to Install Memcached on Ubuntu 18.04/16.04 LTS

How to Install phpMyAdmin on Ubuntu 18.04/16.04

Shweta Mamidwar

I am Shweta Mamidwar working as a Intern in Product Company. Likes to share knowledge.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap