SlideShare a Scribd company logo
PHP
www.PracticalCoding.in
A bit about PHP
➢Originally stood for Personal Home
Pages
➢Acronym changed to Hypertext
Preprocessor
www.PracticalCoding.inwww.PracticalCoding.in
Introduction to PHP rules
➢ PHP code is always enclosed by <?php…?>
➢ Every PHP statement must terminate with a semicolon(;)
➢ If there is PHP code on your page, file extension has to be .php
➢ PHP Variables must begin with a $ symbol
➢ Spaces and special characters other than _ and $ are not allowed in a
variable name
➢ Use ‘echo’ or ‘print’ commands to output data
www.PracticalCoding.inwww.PracticalCoding.in
➢ Single Quotes
➢ Double Quotes
➢ Newline
➢ Commenting (single line and multiline)
➢ Case (in)sensitive
➢ Variables
➢ Local and Global scope of variables
www.PracticalCoding.inwww.PracticalCoding.in
Loops
➢ while
➢ do...while
➢ for
➢ foreach ($array as $value)
➢ foreach (array_expression as $key => $value)
www.PracticalCoding.inwww.PracticalCoding.in
Strings in PHP
➢ strlen(‘Any data’);
➢ str_word_count(“Counting words”);
➢ strrev(“Gadag”);
➢ Complete list of functions:
http://php.net/manual/en/ref.strings.php
www.PracticalCoding.inwww.PracticalCoding.in
PHP CONSTANTS
➢Identifier for a value
➢define(name, value, case-insensitive)
➢Global
➢$ not required while using
www.PracticalCoding.inwww.PracticalCoding.in
PHP Conditional Statements
1. if statement
2. if...else statement
3. if...elseif....else statement
4. switch statement
www.PracticalCoding.inwww.PracticalCoding.in
User defined functions in PHP
function functionName($arg1,$arg2=56) {
code to be executed;
return $someVariable;
}
www.PracticalCoding.inwww.PracticalCoding.in
PHP Arrays
➢ PHP Indexed array
➢ Loop through an Indexed Array (Exercise)
------------------------------------------------------------------------------------
-
➢ PHP Associative arrays
➢ Loop through an Associative Array (Exercise)
www.PracticalCoding.inwww.PracticalCoding.in
PHP Array Sorting
➢ sort()
➢ rsort()
➢ asort()
➢ ksort()
➢ arsort()
➢ krsort()
www.PracticalCoding.inwww.PracticalCoding.in
PHP Superglobals
➢ $GLOBALS
➢ $_SERVER
➢ $_REQUEST
➢ $_POST
➢ $_GET
➢ $_FILES
➢ $_ENV
➢ $_COOKIE
➢ $_SESSION
www.PracticalCoding.inwww.PracticalCoding.in
Configure xdebug
Create a quick form submit and look at
$_POST
www.PracticalCoding.inwww.PracticalCoding.in
PHP Form Validations
➢ Check for $_SERVER["REQUEST_METHOD"]
➢ Check if each of the required fields are filled up
➢ empty()
➢ isset()
➢ trim()
➢ stripslashes()
www.PracticalCoding.inwww.PracticalCoding.in
Validate a form...
www.PracticalCoding.in
An exercise on simple validations
➢ Check if the first name and last name have valid
characters ( no numbers/symbols )
➢ Check if the given email ID is a valid email ID
www.PracticalCoding.inwww.PracticalCoding.in
Handling JSON data transfer between PHP and jQuery
{"employees":[
{"firstName":"Rahul", "lastName":"Kejri"},
{"firstName":"Smriti", "lastName":"Gandhi"},
{"firstName":"Kamal", "lastName":"Advani"}
]}
www.PracticalCoding.inwww.PracticalCoding.in
Responding to .get(), $.post() and
$.ajax()
www.PracticalCoding.inwww.PracticalCoding.in
PHP Documentation
http://php.net/manual/en/
www.PracticalCoding.inwww.PracticalCoding.in
Learn More
@
www.PracticalCoding.in

More Related Content

PPTX
PDF
Quick tour of PHP from inside
ODP
PHP5.5 is Here
ODP
PHP Tips for certification - OdW13
PDF
Profiling php5 to php7
PDF
Building Custom PHP Extensions
PDF
Understanding PHP objects
PDF
07 Introduction to PHP #burningkeyboards
Quick tour of PHP from inside
PHP5.5 is Here
PHP Tips for certification - OdW13
Profiling php5 to php7
Building Custom PHP Extensions
Understanding PHP objects
07 Introduction to PHP #burningkeyboards

What's hot (20)

PDF
PHP7 is coming
ODP
PHP: The easiest language to learn.
PDF
Php7 extensions workshop
PPT
PHP - Introduction to PHP
PDF
Introduction to PHP - Basics of PHP
PPTX
PHP Optimization
PPT
Php Lecture Notes
ODP
Php in 2013 (Web-5 2013 conference)
KEY
Intermediate PHP
PDF
Mysqlnd, an unknown powerful PHP extension
PPTX
Intro to php
PDF
PHP 7 OPCache extension review
PDF
Php and threads ZTS
PPT
Introduction to php php++
PDF
basic concept of php(Gunikhan sonowal)
PPT
PHP POWERPOINT SLIDES
ODP
PHP Basic
PDF
Php extensions workshop
PHP7 is coming
PHP: The easiest language to learn.
Php7 extensions workshop
PHP - Introduction to PHP
Introduction to PHP - Basics of PHP
PHP Optimization
Php Lecture Notes
Php in 2013 (Web-5 2013 conference)
Intermediate PHP
Mysqlnd, an unknown powerful PHP extension
Intro to php
PHP 7 OPCache extension review
Php and threads ZTS
Introduction to php php++
basic concept of php(Gunikhan sonowal)
PHP POWERPOINT SLIDES
PHP Basic
Php extensions workshop
Ad

Viewers also liked (10)

DOC
Relatives
PPTX
Conflitos familiares
PPT
Constelação Familiar - Rodrigo da Costa Rocha - 05/2012
PPTX
Caminhar Sistêmico - Processos, experiências e aprendizados para re-conhecer ...
PDF
Posições nas constelações e seus Efeitos
PPT
Pensamento Sistêmico e Constalações para Coaching - Cornelia Benesch
PPT
Constelação Familiar
PPTX
Abordagem sistêmica
PDF
Constelação familiar parte i
PPT
Constelação Familiar
Relatives
Conflitos familiares
Constelação Familiar - Rodrigo da Costa Rocha - 05/2012
Caminhar Sistêmico - Processos, experiências e aprendizados para re-conhecer ...
Posições nas constelações e seus Efeitos
Pensamento Sistêmico e Constalações para Coaching - Cornelia Benesch
Constelação Familiar
Abordagem sistêmica
Constelação familiar parte i
Constelação Familiar
Ad

Similar to PHP (20)

PPTX
Php basics
PPTX
PPTX
php basics
PPT
Prersentation
PPT
PHP - Web Development
PPT
PHP Fuctions.ppt,IT CONTAINS PHP INCLUDE FUNCTION
PPT
PHP-03-Functions.ppt
PPT
PHP-03-Functions.ppt
PPT
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
PPTX
PHP from soup to nuts Course Deck
PDF
Lecture8
PPTX
Php Vs Phyton
PDF
Living With Legacy Code
PPT
Hacking with hhvm
PPT
Php Tutorial
PPTX
PHP Introduction and Training Material
PDF
Hsc IT 5. Server-Side Scripting (PHP).pdf
PDF
ODP
PPTX
function in php using like three type of function
Php basics
php basics
Prersentation
PHP - Web Development
PHP Fuctions.ppt,IT CONTAINS PHP INCLUDE FUNCTION
PHP-03-Functions.ppt
PHP-03-Functions.ppt
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
PHP from soup to nuts Course Deck
Lecture8
Php Vs Phyton
Living With Legacy Code
Hacking with hhvm
Php Tutorial
PHP Introduction and Training Material
Hsc IT 5. Server-Side Scripting (PHP).pdf
function in php using like three type of function

Recently uploaded (20)

PDF
Classroom Observation Tools for Teachers
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Computing-Curriculum for Schools in Ghana
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Insiders guide to clinical Medicine.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Pre independence Education in Inndia.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
Classroom Observation Tools for Teachers
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Computing-Curriculum for Schools in Ghana
102 student loan defaulters named and shamed – Is someone you know on the list?
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
TR - Agricultural Crops Production NC III.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Insiders guide to clinical Medicine.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pre independence Education in Inndia.pdf
human mycosis Human fungal infections are called human mycosis..pptx
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
01-Introduction-to-Information-Management.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Module 4: Burden of Disease Tutorial Slides S2 2025

PHP

  • 2. A bit about PHP ➢Originally stood for Personal Home Pages ➢Acronym changed to Hypertext Preprocessor www.PracticalCoding.inwww.PracticalCoding.in
  • 3. Introduction to PHP rules ➢ PHP code is always enclosed by <?php…?> ➢ Every PHP statement must terminate with a semicolon(;) ➢ If there is PHP code on your page, file extension has to be .php ➢ PHP Variables must begin with a $ symbol ➢ Spaces and special characters other than _ and $ are not allowed in a variable name ➢ Use ‘echo’ or ‘print’ commands to output data www.PracticalCoding.inwww.PracticalCoding.in
  • 4. ➢ Single Quotes ➢ Double Quotes ➢ Newline ➢ Commenting (single line and multiline) ➢ Case (in)sensitive ➢ Variables ➢ Local and Global scope of variables www.PracticalCoding.inwww.PracticalCoding.in
  • 5. Loops ➢ while ➢ do...while ➢ for ➢ foreach ($array as $value) ➢ foreach (array_expression as $key => $value) www.PracticalCoding.inwww.PracticalCoding.in
  • 6. Strings in PHP ➢ strlen(‘Any data’); ➢ str_word_count(“Counting words”); ➢ strrev(“Gadag”); ➢ Complete list of functions: http://php.net/manual/en/ref.strings.php www.PracticalCoding.inwww.PracticalCoding.in
  • 7. PHP CONSTANTS ➢Identifier for a value ➢define(name, value, case-insensitive) ➢Global ➢$ not required while using www.PracticalCoding.inwww.PracticalCoding.in
  • 8. PHP Conditional Statements 1. if statement 2. if...else statement 3. if...elseif....else statement 4. switch statement www.PracticalCoding.inwww.PracticalCoding.in
  • 9. User defined functions in PHP function functionName($arg1,$arg2=56) { code to be executed; return $someVariable; } www.PracticalCoding.inwww.PracticalCoding.in
  • 10. PHP Arrays ➢ PHP Indexed array ➢ Loop through an Indexed Array (Exercise) ------------------------------------------------------------------------------------ - ➢ PHP Associative arrays ➢ Loop through an Associative Array (Exercise) www.PracticalCoding.inwww.PracticalCoding.in
  • 11. PHP Array Sorting ➢ sort() ➢ rsort() ➢ asort() ➢ ksort() ➢ arsort() ➢ krsort() www.PracticalCoding.inwww.PracticalCoding.in
  • 12. PHP Superglobals ➢ $GLOBALS ➢ $_SERVER ➢ $_REQUEST ➢ $_POST ➢ $_GET ➢ $_FILES ➢ $_ENV ➢ $_COOKIE ➢ $_SESSION www.PracticalCoding.inwww.PracticalCoding.in
  • 13. Configure xdebug Create a quick form submit and look at $_POST www.PracticalCoding.inwww.PracticalCoding.in
  • 14. PHP Form Validations ➢ Check for $_SERVER["REQUEST_METHOD"] ➢ Check if each of the required fields are filled up ➢ empty() ➢ isset() ➢ trim() ➢ stripslashes() www.PracticalCoding.inwww.PracticalCoding.in
  • 16. An exercise on simple validations ➢ Check if the first name and last name have valid characters ( no numbers/symbols ) ➢ Check if the given email ID is a valid email ID www.PracticalCoding.inwww.PracticalCoding.in
  • 17. Handling JSON data transfer between PHP and jQuery {"employees":[ {"firstName":"Rahul", "lastName":"Kejri"}, {"firstName":"Smriti", "lastName":"Gandhi"}, {"firstName":"Kamal", "lastName":"Advani"} ]} www.PracticalCoding.inwww.PracticalCoding.in
  • 18. Responding to .get(), $.post() and $.ajax() www.PracticalCoding.inwww.PracticalCoding.in