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

6. Detailed Explanation of PHP Data Types

Detri Amelia Chandra by Detri Amelia Chandra
15/01/2020
in PHP
0
Detailed Explanation of PHP Data Types

Detailed Explanation of PHP Data Types

0
SHARES
85
VIEWS
Share on FacebookShare on Twitter

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:

Recommended Post

14. PHP Forms – Validation With Required Fields

14. PHP Forms – Validation With Required Fields

13. New Performing PHP Form Handling

  • 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
Previous Post

5. PHP Echo and Print Statements

Next Post

7. Understanding PHP Condition If Else, Elseif Statements

Related Posts

PHP Forms - Validation With Required Fields

14. PHP Forms – Validation With Required Fields

15/02/2020
PHP Forms - Validation With Required Fields

14. PHP Forms – Validation With Required Fields

15/02/2020
PHP Form Handling

13. New Performing PHP Form Handling

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

12. Learn PHP Global Variables – Superglobals With Example

20/01/2020
PHP Array Example, Complete Editions

11. PHP Array Example, Complete Editions

17/01/2020
PHP Function Definition and Example

10. PHP Function Definition and Example

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

7. Understanding PHP Condition If Else, Elseif Statements

Tinggalkan Balasan Batalkan balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

Top Stories

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

30/04/2020
PEMROGRAMAN WEB DAN PERANGKAT BERGERAK – PERPUSTAKAAN PART-1

Pemrograman Web dan Perangkat Bergerak – Perpustakaan Part-1

16/04/2020
PEMROGRAMAN WEB DAN PERANGKAT BERGERAK – PERPUSTAKAAN PART-1

Pemrograman Web dan Perangkat Bergerak – Perpustakaan Part-1

16/04/2020

News & More

Categories

  • Counseling
  • Consultations
  • Relationship
  • Friendship
  • Singlehood

About Us

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Connect on Social

© 2019 JNews - Premium WordPress news & magazine theme by Jegtheme.

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

© 2021 Detri Amelia Chandra - IT Tips and Programming Tutorial.