PHP basics

By | May 19, 2019

PHP Introduction:

  • PHP Stands for “Hyper-Text Pre-Processor”.
  • PHP was created by Rusmus Lerdorf in 1994.
  • PHP is a server-side scripting language.
  • php is used to create web applications.
  • PHP is used to create dynamic websites

Print functions in PHP

There are two functions in PHP which you can use to print.

  1. echo
  2. print

echo is a little bit faster in loading by the browser.

Comments in php:

// double forward slash is used for single line comment in PHP.

/* your comments here */

forward slash Steric and Steric forward slash are used for multiline comments in PHP.

Declaring Variables in PHP

Dollar sign is used to declare variables in PHP.

You must write dollar sign with variable name to declare variable in PHP.

For example:

If I want to declare variable a then I have to write:


Syntax of PHP Code:


 php code is written here


Datatypes in PHP:


String is written within double quotes or it can be written in single quotes also.


$name = “Coding is fun”;

$name = ‘Coding is fun’;


Integer is written without quotes.


$name = 20;


float is written in decimal format.


$name = 20.3;


Boolean is written in the form of true and false.

true is for 1.

false is for 0

Array in PHP:

$names = array(“Jonny”,”Marry”,”Maly”);

echo $name[‘0′,’1′,2’];

I will continue this topic later………………

Category: Php

Leave a Reply

Your email address will not be published. Required fields are marked *