PHP basics

By | May 19, 2019
Spread the love

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:

$a;

Syntax of PHP Code:

<?php

 php code is written here

<?

Datatypes in PHP:

String:

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

example:

$name = “Coding is fun”;

$name = ‘Coding is fun’;

Integer:

Integer is written without quotes.

example:

$name = 20;

float:

float is written in decimal format.

example:

$name = 20.3;

Boolean:

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………………

  •  
    78
    Shares
  • 76
  •  
  •  
  •  
  • 2
  •  
  •  
  •   
  •   
  •   
  •   
  •  
Category: Php

Leave a Reply

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