SlideShare a Scribd company logo
1 of 54
Download to read offline
Introduction of PHP
GRD.Reyes
What is PHP?
 is an acronym for “PHP: Preprocessor”
 a widely-used, open source scripting language
 a powerful tool for making dynamic and interactiveWeb pages.
What is PHP
File?
 can contain text, HTML,CSS, JavaScript, and PHP code
 PHP code are executed on the server, and the result is returned to
the browser as plain HTML
 PHP files have extension ".php"
What can PHP
Do?
 PHP can generate dynamic page content
 PHP can create, open, read, write, delete, and close files on the
server
 PHP can collect form data
 PHP can send and receive cookies
 PHP can add, delete, modify data in your database
 PHP can be used to control user-access
 PHP can encrypt data
 With PHP you are not limited to output HTML.You can output
images, PDF files, and even Flash movies.You can also output
any text, such as XHTML and XML.
Why PHP?
 PHP runs on various platforms (Windows, Linux, Unix, Mac OS X,
etc.)
 PHP is compatible with almost all servers used today (Apache, IIS,
etc.)
 PHP supports a wide range of databases
 PHP is free. Download it from the official PHP resource:
www.php.net
 PHP is easy to learn and runs efficiently on the server side
What do we
need to run
PHPScript?
 Linux or Windows - provides the base operating system (OS) and
server environment
 Apache or IIS (HTTP SERVER) – intercepts HTTP request and
either serves them directly or passes them on the PHP Interreter
for execution.
 MySQL - the MySQL RDBMS serves as the data storage engine,
accepting connections from the PHP layer and inserting,
modifying, or retrieving data
 PHP PACKAGE - the PHP interpreter parses and executes PHP
code, and returns the results to the web server
Four Rules in
PHP coding
 PHP script starts with <?php and ends with ?>
 PHP statement must end in a semicolon (;)
 Text that is not a command must be put in quotes
 Any time you have a curly bracket or parenthesis, you should have
a matching end bracket or parenthesis.
Embedding
PHP within
HTML
The echo is a PHP predefined functions used to output text,
numeric or variable values in the screen display.
Remember:
You can insert the PHP scripts in any portions of the HTML tags.
Also you can embed HTML tags in PHP statements however it will be
treated as text.
' ' (Single Quotes)
Content inside single quotes is evaluated literally.
Example
$string = 'Single Quotes';
echo '$string'; //Outputs: $string
"" (double quotes) –Variables inside double quotes are evaluated for
their values.
Example
$string= "Single Quotes ";
echo " $string "; //Outputs: Single Quotes
Variables and
DataTypes
Rules in
Naming PHP
Variables
 A variable name must start with a letter or the underscore
character
 A variable name cannot start with a number
 A variable name can only contain alpha-numeric characters and
underscores (A-z, 0-9, and _ )
 Variable names are case-sensitive ($age and $AGE are two
different variables)
DataTypes
The values assigned to a PHP variable may be of different data types
including simple string and numeric types to more complex data types
like arrays and objects.
PHP supports eight data types:
1. String
2. Integer
3. Float (floating point numbers - also called double)
4. Boolean
5. Array
6. Object
7. NULL
PHPStrings
 A string is a sequence of characters, like "Hello world!".
 A string can be any text inside quotes.You can use single or double
quotes:
PHPStrings
(Cont.)
PHPStrings
(Cont.)
PHPStrings
(Cont.)
PHPStrings
(Cont.)
DataTypes
The values assigned to a PHP variable may be of different data types
including simple string and numeric types to more complex data types
like arrays and objects.
PHP supports eight data types:
1. String
2. Integer
3. Float (floating point numbers - also called double)
4. Boolean
5. Array
6. Object
7. NULL
PHP Integer
PHP Integer
(Cont.)
DataTypes
The values assigned to a PHP variable may be of different data types
including simple string and numeric types to more complex data types
like arrays and objects.
PHP supports eight data types:
1. String
2. Integer
3. Float (floating point numbers - also called double)
4. Boolean
5. Array
6. Object
7. NULL
PHP Float
DataTypes
The values assigned to a PHP variable may be of different data types
including simple string and numeric types to more complex data types
like arrays and objects.
PHP supports eight data types:
1. String
2. Integer
3. Float
4. Boolean
5. Array
6. Object
7. NULL
PHP Boolean
DataTypes
The values assigned to a PHP variable may be of different data types
including simple string and numeric types to more complex data types
like arrays and objects.
PHP supports eight data types:
1. String
2. Integer
3. Float
4. Boolean
5. Array
6. Object
7. NULL
PHPArray
PHPArray
(Cont.)
PHPOperators
Operators are used to perform operations on variables and values.
PHP divides the operators in the following groups:
1. Arithmetic
2. Relational
3. Logical
4. String
5. Unary
Arithmetic
Operators
 Addition [+]
 Subtraction [-]
 Multiplication [*]
 Division [/]
 Modulus (division remainder) [%]
Arithmetic
Operators
(Cont.)
Arithmetic
Operators
(Cont.)
PHPOperators
Operators are used to perform operations on variables and values.
PHP divides the operators in the following groups:
1. Arithmetic
2. Relational
3. Logical
4. String
5. Unary
Relational
Operators
Relational
Operators
(Cont.)
Relational
Operators
(Cont.)
PHPOperators
Operators are used to perform operations on variables and values.
PHP divides the operators in the following groups:
1. Arithmetic
2. Relational
3. Logical
4. String
5. Unary
Logical
Operators
Logical
Operators
(Cont.)
Assignment
Operators
Other
Operators
Conditional
Control
Structure
 if statement - executes some code only if a specified condition is
true
 if...else statement - executes some code if a condition is true and
another code if the condition is false
 if...elseif....else statement - specifies a new condition to test, if
the first condition is false switch statement - selects one of
many blocks of code to be executed
Conditional
Control
Structure
(Cont.)
Conditional
Control
Structure
(Cont.)
Conditional
Control
Structure
(Cont.)
Conditional
Control
Structure
(Cont.)
Conditional
Control
Structure
(Cont.)
Switch
Statement
(Cont.)
Switch
Statement
(Cont.)
Repetition
Control
Structure
Repetition
Control
Structure
(Cont.)
Repetition
Control
Structure
(Cont.)
Repetition
Control
Structure
(Cont.)
Repetition
Control
Structure
(Cont.)
End.

More Related Content

Similar to Introduction of PHP.pdf (20)

chapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdfchapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdf
 
Php
PhpPhp
Php
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
PHP Basic & Variables
PHP Basic & VariablesPHP Basic & Variables
PHP Basic & Variables
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
 
Php Unit 1
Php Unit 1Php Unit 1
Php Unit 1
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
PHP Basics Ebook
PHP Basics EbookPHP Basics Ebook
PHP Basics Ebook
 
phptutorial
phptutorialphptutorial
phptutorial
 
phptutorial
phptutorialphptutorial
phptutorial
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php&amp;yii2
Php&amp;yii2Php&amp;yii2
Php&amp;yii2
 
Php by shivitomer
Php by shivitomerPhp by shivitomer
Php by shivitomer
 
PHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERSPHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERS
 
Php1
Php1Php1
Php1
 
Introduction to PHP.ppt
Introduction to PHP.pptIntroduction to PHP.ppt
Introduction to PHP.ppt
 
Php Basics
Php BasicsPhp Basics
Php Basics
 
Introduction to-php
Introduction to-phpIntroduction to-php
Introduction to-php
 

Recently uploaded

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 ...EduSkills OECD
 
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.pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
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 GraphThiyagu K
 
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...christianmathematics
 
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.pdfJayanti Pande
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 

Recently uploaded (20)

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 ...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
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
 
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...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
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
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 

Introduction of PHP.pdf