SlideShare uma empresa Scribd logo
1 de 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; 	?>

Mais conteúdo relacionado

Mais procurados

Operators in c language
Operators in c languageOperators in c language
Operators in c language
Amit Singh
 
Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
alish sha
 

Mais procurados (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
 

Destaque

Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
honglee71
 
Types of databases
Types of databasesTypes of databases
Types of databases
PAQUIAAIZEL
 

Destaque (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)
 

Semelhante a Php-Continuation

Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
mussawir20
 
Java Script Language Tutorial
Java Script Language TutorialJava Script Language Tutorial
Java Script Language Tutorial
vikram 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 Kian
phelios
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
jahanullah
 
C++ Function
C++ FunctionC++ Function
C++ Function
Hajar
 

Semelhante a 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
 

Mais de lotlot

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

Mais de 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
 

Último

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Último (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 

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; ?>