Detri Amelia Chandra
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor
No Result
View All Result
Detriamelia.com
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor
No Result
View All Result
Detriamelia.com
No Result
View All Result

6. Detailed Explanation of PHP Data Types

15/01/2020
in PHP
Detailed Explanation of PHP Data Types

Detailed Explanation of PHP Data Types

This session, I will explain in detail about PHP Data Types. Variables contained in PHP can store data of different types, and different data types can do different things. The concept of variables in PHP is actually almost the same as other programming languages.
But to be more complete, PHP supports the following data types:

  • String
  • Integer
  • Float (floating point numbers – also called double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource

[the_ad id=”651″]

PHP String

A string is an arrangement of characters, similar to “Hello world!”.
A string can be any content inside statements. You can utilize single or twofold statements. Example is :

1
2
3
4
5
6
7
<?php
$x = "Hello world!";
$y = 'Hello world!';
echo $x;
echo "<br>";
echo $y;
?>

PHP Integer

A whole number information type is a non-decimal number between – 2,147,483,648 and 2,147,483,647.
Rules for numbers:

  • A number must have at any rate one digit
  • A number must not have a decimal point
  • A number can be either positive or negative
  • Numbers can be determined in: decimal (base 10), hexadecimal (base 16), octal (base 8), or double (base 2) documentation

In the accompanying model $x is a number. The PHP var_dump() work restores the information type and worth. See the example below:

1
2
3
4
<?php
$x = 5985;
var_dump($x);
?>

PHP Float

A buoy (skimming point number) is a number with a decimal point or a number in exponential structure.
In the accompanying model $x is a buoy. The PHP var_dump() work restores the information type and worth. See the example below:

1
2
3
4
<?php
$x = 10.365;
var_dump($x);
?>

PHP Boolean

A Boolean represents two possible states: TRUE or FALSE.

1
2
$x = true;
$y = false;

Booleans are regularly utilized in restrictive testing. You will become familiar with restrictive testing in a later part of this instructional exercise.

PHP Array

An array stores multiple values in one single variable.
In the following example $cars is an array. The PHP var_dump() function returns the data type and value. See the example below:

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

You will become familiar with much progressively about clusters in later parts of this instructional exercise.

PHP Object

An article is an information type which stores information and data on the most proficient method to process that information.
In PHP, an article must be expressly pronounced.
First we should proclaim a class of item. For this, we utilize the class watchword. A class is a structure that can contain properties and techniques. See the example below:

1
2
3
4
5
6
7
8
9
10
11
<?php
class Car {
    function Car() {
        $this->model = "VW";
    }
}
// create an object
$herbie = new Car();
// show object properties
echo $herbie->model;
?>

PHP NULL Value

NULL is an exceptional information type which can have just one worth: NULL.
A variable of information type NULL is a variable that has no worth relegated to it.
Tip: If a variable is made without a worth, it is consequently allocated an estimation of NULL.
Factors can likewise be exhausted by setting the incentive to NULL. See the example below:

1
2
3
4
5
<?php
$x = "Hello world!";
$x = null;
var_dump($x);
?>

PHP Resource

The uncommon asset type isn’t a real information type. It is the putting away of a reference to capacities and assets outer to PHP.
A typical case of utilizing the asset information type is a database call.
We won’t discuss the asset type here, since it is a propelled theme.

Tags: PHP
ShareTweetShare

Related Posts

PHP Forms - Validation With Required Fields
PHP

14. PHP Forms – Validation With Required Fields

Hi everyone, this time we will discuss about PHP Validation using the Required Field. Not many people know, it turns...

15/02/2020
PHP Form Handling
PHP

13. New Performing PHP Form Handling

Detriamelia.Com - Running form functions in PHP is not difficult. By using the $ _POST and $ _GET methods it...

13/02/2020
Learn PHP Global Variables - Superglobals With Example
PHP

12. Learn PHP Global Variables – Superglobals With Example

On this occasion, we will discuss Global and Superglobal Variables. These variables are some that are very important to implement....

20/01/2020
PHP Array Example, Complete Editions
PHP

11. PHP Array Example, Complete Editions

Welcome back to the PHP programming learning page. This time we will discuss arrays, more precisely arrays in PHP. Arrays...

17/01/2020
Next Post
Understanding PHP Condition If Else, Elseif Statements

7. Understanding PHP Condition If Else, Elseif Statements

PHP Switch Statement

8. PHP Switch Statement

Leave a Reply Cancel reply

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

Recommended

Understanding PHP Condition If Else, Elseif Statements

7. Understanding PHP Condition If Else, Elseif Statements

15/01/2020
What You Must Know About PHP

1. What You Must Know About PHP

10/11/2019
Easy to Identify Identity Card Number (NIK) Using PHP

Easy to Identify Identity Card Number (NIK) Using PHP

27/03/2019
Cara Mudah Memahami Bahasa Pemrograman Python

Belajar Dasar-dasar Python untuk Pemula: Cara Mudah Memahami Bahasa Pemrograman Python

06/03/2023

Instagram Feed

  • Sekolah sambil bermain...
  • Produk mahasiswa semester 5 Pendidikan Teknologi Informasi STKIP Rokania..
Kran dispenser otomatis (sensor)
#arduino
#PTI Ok
#STKIPRokania
#AyoKuliahDiRokania
  • Salah satu produk mahasiswa Pendidikan Teknologi Informasi STKIP Rokania...Pemanfaatan Internet Of Thing pada Lampu dan CCTV otomatis dengan Telegram Bot..

#StkipRokania
#PendidikanTeknologiInformasi
  • "Golden Time" yang tidak bisa diputar dan diulang tetapi tersimpan di inner child nya dan diingat selamanya..
  • Selamat atas M.Kom nya yah...semoga ada Reski untuk studi selanjutnya ya...
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
Detriamelia.Com

© 2022 Detri Amelia Chandra - IT Tips and Programming Tutorials.

No Result
View All Result
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor