Data Types uses in PHP

PHP Date Types

Variables will store information of various sorts, and totally different information sorts will do various things.

PHP supports the subsequent information types:

  • String
  • Integer
  • Float (floating purpose numbers - conjointly known as double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource
  • PHP String

A string may be a sequence of characters, like "Hello world!".

A string is any text within quotes. you'll use single or double quotes:

$x = "Hello world!";
$y = 'Hello world!';

echo $x;
echo "
echo $y;

You also can read this below article which is very useful for PHP & Software Developer and Digital Marketing.

How to Define a variable in PHP

How to define array in PHP

Function use in PHP

Applied AI in Software Development

How Digital Marketing Works

Software Improvement by Data Improvement.

PHP Number

An whole {number|number} information sort may be a non-decimal number between -2,147,483,648 and 2,147,483,647.

Rules for integers:

An number should have a minimum of one digit
An number should not have a percentage point
An number is either positive or negative
Integers is per 3 formats: decimal (10-based), hex (16-based - prefixed with 0x) or positional notation (8-based - prefixed with 0)
In the following example $x is AN number. The PHP var_dump() operate returns the information sort and value:


$x = 5985;

PHP Float

A float (floating purpose variety) may be a number with a percentage point or variety in exponential kind.

In the following example $x may be a float. The PHP var_dump() operate returns the information sort and value:


$x = 10.365;

PHP Boolean

A Boolean represents 2 attainable states: TRUE or FALSE.

$x = true;
$y = false;

Booleans area unit typically utilized in conditional testing. you may learn a lot of concerning conditional testing during a later chapter of this tutorial.

PHP Array

An array stores multiple values in one single variable.

In the following example $cars is AN array. The PHP var_dump() operate returns the information sort and value:


$cars = array("Volvo","BMW","Toyota");

PHP Object

An object may be a information sort that stores information {and information|and knowledge|and information} on a way to method that data.

In PHP, AN object should be expressly declared.

First we have a tendency to should declare a category of object. For this, we have a tendency to use the category keyword. a category may be a structure which will contain properties and methods:


class automobile {
operate Car() ">

// produce AN object
$herbie = new Car();

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

PHP NULL worth

Null may be a special information sort which might have only 1 value: NULL.

A variable of information sort NULL may be a variable that has no worth appointed thereto.

Tip: If a variable is formed while not a price, it's mechanically appointed a price of NULL.

Variables also can be empty by setting the worth to NULL:

$x = "Hello world!";
$x = null;


Post a Comment

Popular posts from this blog

How Outsourced Healthcare Services Leads to Improved Patient Experience?

BS6 compliant Ford EcoSport launched in India, price starts at Rs 8.04 lakhs

Benefit of using profile creation for your business