1 of 12

Slide Notes

DownloadGo Live

Th

Published on Nov 22, 2015

Data Types in php

PRESENTATION OUTLINE

Data Types

PHP programming language!

integer

  • A whole Number 
  • Example: 1,2,3…..100 
  • Example in php $a=68
Photo by seagers

Float/double

  • A number with a decimal (or floating number)
  • Example: 2.35, 5.4, 345.6
  • Example in php: $number1=6.8
Photo by Pulpolux !!!

String

  • This data type is a string of characters
  • Can be either letters or puncuations  
  • Example Hi! 
  • Example in php: $name="Rachel?"
Photo by Javier Volcan

Boolean

  • This is a true or false request 
  • Example in php: $test= True, $test=False
Photo by ryanmilani

Array

  • An array is an ordered map
  • Consists of names or values that are mapped in values
  • Example in php:$cars=array("Volvo","BMW","Toyota")
Photo by Ludovico Cera

Object

  • A data type that contains properties and methods
  • Information on how to process data 
Photo by kjetikor

Null

  • This is when a variable does not contain a value 
  • Example in php: $x=null

Loose Typing

  • In php we define our type of variables simply by choosing 
  • the list just given to you. 
  • In C programming you have to define the variable 
  • Example in C programming: int number1; 
  • or char lastname[30]; 
Photo by kevin dooley

Gettype function

  • If ever concerned with what data type you made a variable use gettype  
  • Example: echo gettype($value)
  • This will then display to you what data type $value is
Photo by RLHyde

Changing a VARIABLE

  • settype() function will change a variable that you have already set
  • Example in php: 
  • $a=4.657
  • settype($a."integer") 
  • Result = if you were to type echo $a       4 would appear 
Photo by garryknight

Thanks for watching!

BY: RACHEL RECTOR 
Photo by harold.lloyd