SlideShare a Scribd company logo
1 of 13
PHP: Hypertext Preprocessor The Building Blocks
Special Data Types Resource - Reference to a third-party resource (a database, for example) NULL - An uninitialized variable Sample <?php 	$testing; // declare without assigning 	print gettype( $testing ); // NULL	 	?>
PHP’s Type Functions var_dump()- tells you a variable's type and its contents Sample <php $testing = 5;  var_dump( $testing );  ?>
PHP’s Type Functions gettype()function - to acquire the type of any variable. If you place a variable between the parentheses of the function call, gettype() returns a string representing the relevant type (NULL, integer, string, double , boolean)  Sample <?php $testing = 5;  print gettype( $testing ); // integer  ?>
PHP’s Type Functions settype()function - to change the type of a variable. To use settype(), you must place the variable to change (and the type to change it to) between the parentheses and separate them by commas 	Sample 	<?php 	$undecided = 3.14; settype( $undecided, double ); 	print gettype( $undecided );  	print " -- $undecided<br />"; // 3.14 	?>
Operators and Expressions Operators- are symbols that enable you to use one or more values to produce a new value. A value that is operated on by an operator is referred to as an operand. 4+3   Expression- is any combination of functions, values, and operators that resolves to a value. 4+3=9 	$user=you; gettype( $user);   Assignment Operator - takes the value of its right operand and assigns it to its left operand $name = "matt";
Operators and Expressions Arithmetic Operators - The addition operator adds the right operand to the left operand, whereas the subtraction operator subtracts the right operand from the left. The division operator divides the left operand by the right, and the multiplication operator multiplies the left operand by the right. The modulus operator returns the remainder of the left operand divided by the right. Example (+)Addition 	(-)Subtraction 	(/)Division  (*) Multiplication 	(%)Modulus
Concatenation Operator The concatenation operator is a single period (.). Treating both operands as strings, it appends the right operand to the left Sample "hello"." world" is equivalent to "hello world"  $centimeters = 212;  print "the width is ".($centimeters/100)." meters";
Combined Assignment Operator consists of a standard operator symbol followed by an equals sign. Example $x = 4;$x = $x + 4; // $x now equals 8  	can instead be written as 	$x = 4;$x += 4; // $x now equals 8
Comparison Operators perform tests on their operands. They return the boolean value true if the test is successful and return false otherwise. This type of expression is useful in control structures, such as if and while statements Example $x=5.1 $x < 5
Logical Operators To test combinations of booleans Sample true || false = true 	true && false = false
Operator Precedence When you use an operator, the PHP engine usually reads your expression from left to right. Sample 4 + 5=9 	4 + 5 * 2 = 18    or     4 + 5 * 2 = 14   or   (4 + 5) * 2 = 18
Constants Variables offer a flexible way of storing data because you can change their values and the type of data they store at any time. If, however, you want to work with a value that you do not want to alter throughout your script's execution, you can define a constant. You must use PHP's built-in function define() to create a constant. After you have done this, the constant cannot be changed. To use the define() function, you must place the name of the constant and the value you want to give it within the call's parentheses. These values must be separated by a comma, like so: Example define ("CONSTANT_NAME", 42);  <?php  	define ("USER", "Gerald");  	print "Welcome".USER; 	?>

More Related Content

What's hot (20)

C operator and expression
C operator and expressionC operator and expression
C operator and expression
 
Logical and Conditional Operator In C language
Logical and Conditional Operator In C languageLogical and Conditional Operator In C language
Logical and Conditional Operator In C language
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Functions in c
Functions in cFunctions in c
Functions in c
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Method parameters in c#
Method parameters in c#Method parameters in c#
Method parameters in c#
 
Pointer to function 1
Pointer to function 1Pointer to function 1
Pointer to function 1
 
1. Pointer Basic
1. Pointer Basic1. Pointer Basic
1. Pointer Basic
 
Types of c operators ppt
Types of c operators pptTypes of c operators ppt
Types of c operators ppt
 
Python : basic operators
Python : basic operatorsPython : basic operators
Python : basic operators
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Operator of C language
Operator of C languageOperator of C language
Operator of C language
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
 
Python : Operators
Python : OperatorsPython : Operators
Python : Operators
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#
 
Types of function call
Types of function callTypes of function call
Types of function call
 
Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
 

Viewers also liked

Cio summit 20170223_v20
Cio summit 20170223_v20Cio summit 20170223_v20
Cio summit 20170223_v20Joshua Bae
 
The hippocratic oath
The hippocratic oathThe hippocratic oath
The hippocratic oathDAYANAJOSE002
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4jNeo4j
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph DatabasesMax De Marzi
 
Graph database super star
Graph database super starGraph database super star
Graph database super starandres_taylor
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overviewhonglee71
 
HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)Gurjot Singh
 
Types of databases
Types of databasesTypes of databases
Types of databasesPAQUIAAIZEL
 
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)Beat Signer
 

Viewers also liked (11)

Cio summit 20170223_v20
Cio summit 20170223_v20Cio summit 20170223_v20
Cio summit 20170223_v20
 
The hippocratic oath
The hippocratic oathThe hippocratic oath
The hippocratic oath
 
Types of database
Types of databaseTypes of database
Types of database
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 
Graph database super star
Graph database super starGraph database super star
Graph database super star
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
 
HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)
 
Types of databases
Types of databasesTypes of databases
Types of databases
 
Graph database
Graph database Graph database
Graph database
 
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
 

Similar to Php-Continuation

Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functionsmussawir20
 
Java Script Language Tutorial
Java Script Language TutorialJava Script Language Tutorial
Java Script Language Tutorialvikram singh
 
P H P Part I, By Kian
P H P  Part  I,  By  KianP H P  Part  I,  By  Kian
P H P Part I, By Kianphelios
 
Expressions and Operators.pptx
Expressions and Operators.pptxExpressions and Operators.pptx
Expressions and Operators.pptxJapneet9
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics McSoftsis
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpen Gurukul
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)jahanullah
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requireTheCreativedev Blog
 
Project in TLE
Project in TLEProject in TLE
Project in TLEPGT_13
 
02 Php Vars Op Control Etc
02 Php Vars Op Control Etc02 Php Vars Op Control Etc
02 Php Vars Op Control EtcGeshan Manandhar
 
C++ Function
C++ FunctionC++ Function
C++ FunctionHajar
 
Vb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadVb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadHock Leng PUAH
 
1_Python Basics.pdf
1_Python Basics.pdf1_Python Basics.pdf
1_Python Basics.pdfMaheshGour5
 

Similar to Php-Continuation (20)

PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
Php Learning show
Php Learning showPhp Learning show
Php Learning show
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
 
Java Script Language Tutorial
Java Script Language TutorialJava Script Language Tutorial
Java Script Language Tutorial
 
P H P Part I, By Kian
P H P  Part  I,  By  KianP H P  Part  I,  By  Kian
P H P Part I, By Kian
 
Expressions and Operators.pptx
Expressions and Operators.pptxExpressions and Operators.pptx
Expressions and Operators.pptx
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHP
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
Basics of c++
Basics of c++ Basics of c++
Basics of c++
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
 
Project in TLE
Project in TLEProject in TLE
Project in TLE
 
Operators in PHP
Operators in PHPOperators in PHP
Operators in PHP
 
02 Php Vars Op Control Etc
02 Php Vars Op Control Etc02 Php Vars Op Control Etc
02 Php Vars Op Control Etc
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Vb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadVb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary Upload
 
1_Python Basics.pdf
1_Python Basics.pdf1_Python Basics.pdf
1_Python Basics.pdf
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 

More from lotlot

Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchartlotlot
 
Form Script
Form ScriptForm Script
Form Scriptlotlot
 
Mysql Aggregate
Mysql AggregateMysql Aggregate
Mysql Aggregatelotlot
 
Mysql Script
Mysql ScriptMysql Script
Mysql Scriptlotlot
 
Php Form
Php FormPhp Form
Php Formlotlot
 
Php Loop
Php LoopPhp Loop
Php Looplotlot
 
Php Condition Flow
Php Condition FlowPhp Condition Flow
Php Condition Flowlotlot
 
Hariyali - India
Hariyali - IndiaHariyali - India
Hariyali - Indialotlot
 
The Province Of Davao Oriental
The Province Of Davao OrientalThe Province Of Davao Oriental
The Province Of Davao Orientallotlot
 
Annual Review
Annual ReviewAnnual Review
Annual Reviewlotlot
 

More from lotlot (11)

Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 
Form Script
Form ScriptForm Script
Form Script
 
Mysql Aggregate
Mysql AggregateMysql Aggregate
Mysql Aggregate
 
Mysql Script
Mysql ScriptMysql Script
Mysql Script
 
Mysql
MysqlMysql
Mysql
 
Php Form
Php FormPhp Form
Php Form
 
Php Loop
Php LoopPhp Loop
Php Loop
 
Php Condition Flow
Php Condition FlowPhp Condition Flow
Php Condition Flow
 
Hariyali - India
Hariyali - IndiaHariyali - India
Hariyali - India
 
The Province Of Davao Oriental
The Province Of Davao OrientalThe Province Of Davao Oriental
The Province Of Davao Oriental
 
Annual Review
Annual ReviewAnnual Review
Annual Review
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Php-Continuation

  • 1. PHP: Hypertext Preprocessor The Building Blocks
  • 2. Special Data Types Resource - Reference to a third-party resource (a database, for example) NULL - An uninitialized variable Sample <?php $testing; // declare without assigning print gettype( $testing ); // NULL ?>
  • 3. PHP’s Type Functions var_dump()- tells you a variable's type and its contents Sample <php $testing = 5; var_dump( $testing ); ?>
  • 4. PHP’s Type Functions gettype()function - to acquire the type of any variable. If you place a variable between the parentheses of the function call, gettype() returns a string representing the relevant type (NULL, integer, string, double , boolean) Sample <?php $testing = 5; print gettype( $testing ); // integer ?>
  • 5. PHP’s Type Functions settype()function - to change the type of a variable. To use settype(), you must place the variable to change (and the type to change it to) between the parentheses and separate them by commas Sample <?php $undecided = 3.14; settype( $undecided, double ); print gettype( $undecided ); print " -- $undecided<br />"; // 3.14 ?>
  • 6. Operators and Expressions Operators- are symbols that enable you to use one or more values to produce a new value. A value that is operated on by an operator is referred to as an operand. 4+3   Expression- is any combination of functions, values, and operators that resolves to a value. 4+3=9 $user=you; gettype( $user);   Assignment Operator - takes the value of its right operand and assigns it to its left operand $name = "matt";
  • 7. Operators and Expressions Arithmetic Operators - The addition operator adds the right operand to the left operand, whereas the subtraction operator subtracts the right operand from the left. The division operator divides the left operand by the right, and the multiplication operator multiplies the left operand by the right. The modulus operator returns the remainder of the left operand divided by the right. Example (+)Addition (-)Subtraction (/)Division (*) Multiplication (%)Modulus
  • 8. Concatenation Operator The concatenation operator is a single period (.). Treating both operands as strings, it appends the right operand to the left Sample "hello"." world" is equivalent to "hello world" $centimeters = 212; print "the width is ".($centimeters/100)." meters";
  • 9. Combined Assignment Operator consists of a standard operator symbol followed by an equals sign. Example $x = 4;$x = $x + 4; // $x now equals 8 can instead be written as $x = 4;$x += 4; // $x now equals 8
  • 10. Comparison Operators perform tests on their operands. They return the boolean value true if the test is successful and return false otherwise. This type of expression is useful in control structures, such as if and while statements Example $x=5.1 $x < 5
  • 11. Logical Operators To test combinations of booleans Sample true || false = true true && false = false
  • 12. Operator Precedence When you use an operator, the PHP engine usually reads your expression from left to right. Sample 4 + 5=9 4 + 5 * 2 = 18 or 4 + 5 * 2 = 14 or (4 + 5) * 2 = 18
  • 13. Constants Variables offer a flexible way of storing data because you can change their values and the type of data they store at any time. If, however, you want to work with a value that you do not want to alter throughout your script's execution, you can define a constant. You must use PHP's built-in function define() to create a constant. After you have done this, the constant cannot be changed. To use the define() function, you must place the name of the constant and the value you want to give it within the call's parentheses. These values must be separated by a comma, like so: Example define ("CONSTANT_NAME", 42); <?php define ("USER", "Gerald"); print "Welcome".USER; ?>