WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP 5 echo and print Statements



PHP Data Types

Variables can store information of various kinds, and diverse information types can do diverse things.

PHP underpins the accompanying information types:

  • String
  • Integer
  • Float (coasting point numbers - additionally called double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource

PHP String

A string is a grouping of characters, as "Hello PHP5!".

A string can be any content inside statements. You can utilize single or twofold quotes:

Example

<?php
$x = "Hello PHP5!";
$y = 'Hi PHP5!';

echo $x;
echo "<br>";
echo $y;
?>

PHP Integer

An whole number information type is a non-decimal number between - 3,154,324,789 and 3,154,324,789.

Rules for integers:

  • An number must have no less than one digit
  • An number must not have a decimal point
  • An number can be either positive or negative

In the accompanying model $x is a whole number. The PHP var_dump() work restores the information type and value:

Example

<?php
$x = 5985;
var_dump($x);
?>

PHP Float

A skimming point number is a number with a decimal point or a number in exponential form.

In the accompanying precedent $x is a buoy. The PHP var_dump() work restores the information type and value:

Example

<?php
$x = 15.528;
var_dump($x);
?>

PHP Boolean

A Boolean speaks to two conceivable states: TRUE or FALSE.

$x = false;

PHP Array

An exhibit stores different qualities in a single variable.

In the accompanying model $cars is an exhibit. The PHP var_dump() work restores the information type and value:

Example

<?php
$cars = array("Volvo","BMW","Toyota");
var_dump($cars);
?>

You will become familiar with significantly progressively about clusters in later sections of this tutorial.


PHP Object

An object is an information type which stores information and data on the most proficient method to process that data.

Example

<?php
class Car {
    work Car() {
        $this->model = "VW";
    }
}

//make an object
$herbie = new Car();

//show object properties
echo $herbie->model;
?>

You will get familiar with articles in a later section of this tutorial.


PHP NULL Value

Null is an exceptional information type which can have just a single esteem: NULL.

A variable of information type NULL is a variable that has no esteem alloted to it.

Tip: If a variable is made without an esteem, it is consequently allocated an estimation of NULL.

Variables can likewise be purged by setting the incentive to NULL:

Example

<?php
$x = "Hello PHP5!";
$x = null;
var_dump($x);
?>

PHP Resource

The extraordinary asset type isn't a real information type. It is the putting away of a reference to capacities and assets outside to PHP.

A normal case of utilizing the asset information type is a database call.

We won't discuss the asset type here, since it is a progressed topic.