SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
DATA TYPES IN PHP1WWW.USTUDY.IN
Data typeA data type refers to the type of data a variable can store. PHP has eight (8) different data typesinteger numbersfloating point numbersstringsBooleansarraysobjectsresourcesnull2WWW.USTUDY.IN
IntegerThe integer data type is used to specify a numeric value without a fractional component. you can declare as given belowinteger $variable; 	$variable =10;3WWW.USTUDY.IN
Real NumberIt is also known as a floating number or floating point number. It is not a whole number and has fractions such as 1.22, 2.45, 100.765 etc.Some examples of valid floating point numbers include: 3.14 0.001 -1.234 0.314E2 // 31.4 1.234E-5 // 0.00001234 -3.45E-3 // -0.00345 4WWW.USTUDY.IN
Boolean Boolean values are true or false, also 0 and empty string evaluates to false, and any numeric value rather than zero, or a string that is not empty evaluates to true. you can declare as given belowBoolean $variable; where Boolean denotes the type of the variable.5WWW.USTUDY.IN
String String values are sequence of characters, included in a single quote or double quotes, for example, $str1 = "This is a string data type variable";A string literal can be specified in four different ways: single quoted double quoted heredoc syntax nowdoc syntax 6WWW.USTUDY.IN
Single quotedThe simplest way to specify a string is to enclose it in single quotes    Example:		   <?php		echo 'this is a simple string';	    ?>WWW.USTUDY.IN7
Double quotedIf the string is enclosed in double-quotes ("),Example:“This is \n a string”, this will evaluate to: This is a string WWW.USTUDY.IN8
Here DocumentsThe heredoc string structure is a method of including larger strings inside the code. we can use it to include content of any length. To create a heredoc, use a special operator that is made up of three left brackets ( <<< ). The syntax is as follows: $longString = <<< termination_marker any amount of content termination_marker; 9WWW.USTUDY.IN
NowdocNowdocs are to single-quoted strings what heredocs are to double-quoted strings. A nowdoc is specified similarly to a heredoc, but no parsing is done inside a nowdoc.10WWW.USTUDY.IN
Array An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other array s, trees and multidimensional array s are also possible. WWW.USTUDY.IN11
Resource Resources are not an actual data type, but the storing of a reference to functions and resources external to PHP. The most common example of using the resource data type is a database call. 12WWW.USTUDY.IN
Null Null is a special data type which can have only one value, which is itself. Which is to say, null is not only a data type, but also a keyword literal. A variable of data type null is a variable that has no value assigned to it. WWW.USTUDY.IN13
The End14WWW.USTUDY.IN

More Related Content

PPTX
PHP FUNCTIONS
PPTX
Php string function
PDF
Methods in Java
PDF
Arrays in Java
PPTX
Method overloading
PPTX
Variables in python
PPTX
Pointers in c++
PPT
Javascript
PHP FUNCTIONS
Php string function
Methods in Java
Arrays in Java
Method overloading
Variables in python
Pointers in c++
Javascript

What's hot (20)

PPTX
Super keyword in java
PPTX
Operators in java
PDF
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
PPTX
Fundamentals of Python Programming
PPTX
Php.ppt
PDF
Java data types, variables and jvm
PDF
Class and Objects in Java
PPTX
Abstract Data Types
PPTX
Tokens in C++
PPTX
Inheritance in java
PPTX
Type casting in java
PPT
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PDF
Java I/o streams
PPTX
Data types in java
PPSX
Php and MySQL
PPTX
Css selectors
PPTX
Methods in java
PPTX
PPT
Control structure C++
PPTX
Lesson 2 php data types
Super keyword in java
Operators in java
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Fundamentals of Python Programming
Php.ppt
Java data types, variables and jvm
Class and Objects in Java
Abstract Data Types
Tokens in C++
Inheritance in java
Type casting in java
PHP - DataType,Variable,Constant,Operators,Array,Include and require
Java I/o streams
Data types in java
Php and MySQL
Css selectors
Methods in java
Control structure C++
Lesson 2 php data types
Ad

Similar to Data types in php (20)

PPTX
Chap1introppt2php(finally done)
PDF
Zend%20Certification%20REVIEW%20Document
PDF
Zend%20Certification%20REVIEW%20Document
PPTX
Basics of PHP by Dr.C.R.Dhivyaa Kongu Engineering College
PPTX
UNIT 1 (7).pptx
PPTX
UNIT 1 (7).pptx
PPTX
The basics of php for engeneering students
PPTX
chapter Two Server-side Script lang.pptx
PPTX
PHP 2.pptx
PPT
Php basics
PDF
Php Crash Course - Macq Electronique 2010
PDF
PHP-Part1
PDF
2014 database - course 2 - php
PPTX
PHP Course (Basic to Advance)
PPTX
PHP Basics
PPTX
Working With Variables-[LAA] PHP Lj.pptx
PDF
50 shades of PHP
PPTX
PHP Lecture 01 .pptx PHP Lecture 01 pptx
PPTX
PDF
WT_PHP_PART1.pdf
Chap1introppt2php(finally done)
Zend%20Certification%20REVIEW%20Document
Zend%20Certification%20REVIEW%20Document
Basics of PHP by Dr.C.R.Dhivyaa Kongu Engineering College
UNIT 1 (7).pptx
UNIT 1 (7).pptx
The basics of php for engeneering students
chapter Two Server-side Script lang.pptx
PHP 2.pptx
Php basics
Php Crash Course - Macq Electronique 2010
PHP-Part1
2014 database - course 2 - php
PHP Course (Basic to Advance)
PHP Basics
Working With Variables-[LAA] PHP Lj.pptx
50 shades of PHP
PHP Lecture 01 .pptx PHP Lecture 01 pptx
WT_PHP_PART1.pdf
Ad

More from ilakkiya (10)

PPTX
History object
PPTX
Twisted pair cable
PPTX
Infrared
PPTX
Network topology
PPTX
Looping statement in vb.net
PPTX
Looping statement
PPTX
Conditional statement
PPTX
Array in php
PPTX
Decision statements in vb.net
PPTX
Addressing mode
History object
Twisted pair cable
Infrared
Network topology
Looping statement in vb.net
Looping statement
Conditional statement
Array in php
Decision statements in vb.net
Addressing mode

Recently uploaded (20)

PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Business Ethics Teaching Materials for college
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Cell Structure & Organelles in detailed.
PDF
RMMM.pdf make it easy to upload and study
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
VCE English Exam - Section C Student Revision Booklet
Basic Mud Logging Guide for educational purpose
Renaissance Architecture: A Journey from Faith to Humanism
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Business Ethics Teaching Materials for college
Pharmacology of Heart Failure /Pharmacotherapy of CHF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Cell Structure & Organelles in detailed.
RMMM.pdf make it easy to upload and study
STATICS OF THE RIGID BODIES Hibbelers.pdf

Data types in php

  • 1. DATA TYPES IN PHP1WWW.USTUDY.IN
  • 2. Data typeA data type refers to the type of data a variable can store. PHP has eight (8) different data typesinteger numbersfloating point numbersstringsBooleansarraysobjectsresourcesnull2WWW.USTUDY.IN
  • 3. IntegerThe integer data type is used to specify a numeric value without a fractional component. you can declare as given belowinteger $variable; $variable =10;3WWW.USTUDY.IN
  • 4. Real NumberIt is also known as a floating number or floating point number. It is not a whole number and has fractions such as 1.22, 2.45, 100.765 etc.Some examples of valid floating point numbers include: 3.14 0.001 -1.234 0.314E2 // 31.4 1.234E-5 // 0.00001234 -3.45E-3 // -0.00345 4WWW.USTUDY.IN
  • 5. Boolean Boolean values are true or false, also 0 and empty string evaluates to false, and any numeric value rather than zero, or a string that is not empty evaluates to true. you can declare as given belowBoolean $variable; where Boolean denotes the type of the variable.5WWW.USTUDY.IN
  • 6. String String values are sequence of characters, included in a single quote or double quotes, for example, $str1 = "This is a string data type variable";A string literal can be specified in four different ways: single quoted double quoted heredoc syntax nowdoc syntax 6WWW.USTUDY.IN
  • 7. Single quotedThe simplest way to specify a string is to enclose it in single quotes Example: <?php echo 'this is a simple string'; ?>WWW.USTUDY.IN7
  • 8. Double quotedIf the string is enclosed in double-quotes ("),Example:“This is \n a string”, this will evaluate to: This is a string WWW.USTUDY.IN8
  • 9. Here DocumentsThe heredoc string structure is a method of including larger strings inside the code. we can use it to include content of any length. To create a heredoc, use a special operator that is made up of three left brackets ( <<< ). The syntax is as follows: $longString = <<< termination_marker any amount of content termination_marker; 9WWW.USTUDY.IN
  • 10. NowdocNowdocs are to single-quoted strings what heredocs are to double-quoted strings. A nowdoc is specified similarly to a heredoc, but no parsing is done inside a nowdoc.10WWW.USTUDY.IN
  • 11. Array An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other array s, trees and multidimensional array s are also possible. WWW.USTUDY.IN11
  • 12. Resource Resources are not an actual data type, but the storing of a reference to functions and resources external to PHP. The most common example of using the resource data type is a database call. 12WWW.USTUDY.IN
  • 13. Null Null is a special data type which can have only one value, which is itself. Which is to say, null is not only a data type, but also a keyword literal. A variable of data type null is a variable that has no value assigned to it. WWW.USTUDY.IN13