SlideShare a Scribd company logo
INTRODUCTION TO PHP
Source: Pensyarah Uitm Jasin, Melaka
OUTLINE
Introduction to Server Side Script01
Introduction to PHP02
Variables and Data Types03
How Server Side Script Works
Your Text Here
request
response
Web browser/Client Server
run server side
script
run the script
generate HTML
code
Database
maybe get some
data from database
Introduction to PHP
• PHP : recursive acronym for "PHP Hypertext Preprocessor“
• Developed in 1995
• Widely-used Open Source scripting language that enables to create
interactive web sites and can be embedded into HTML.
• PHP provides many great features:
• free, easy to learn, fun to use, connects to most databases
• provides many levels of security
• available on most systems: Windows, Linux, Mac OS, etc
• lots of built-in functions
Getting PHP to Work
Three important components need to be installed on the computer system:
 Web server – e.g. Apache (most widely used  free), IIS, PWS
 PHP software distribution (parser)
 Latest stable release is PHP 4.3.7
 PHP version 5 is also available, but this is considered a “release
candidate”.
 Database – e.g. MySQL (most popular RDBMS used over the Internet 
free, fast, flawless), Oracle, Sybase
PHP Basic Syntax
• All PHP code must be included inside one of these special markup tags:
• PHP files must be saved with a php extension, e.g.: .php, .php3 or .php4
• Every statement in PHP must be terminated with a semicolon (;)
• PHP is not generally case-sensitive
• Characters to indicate Comments:
• // or # : single-line comment
• /* here is an introduction to server side script code
inside a multi-line comment */ : multi-line comment
<?php php code goes here ?>
<script language=“php”> php code goes here </script>
Example 1
Save as exe1.php
Output
<html>
<?php
echo “<h1> Hello, World!</h1>”;
?>
</html>
Variables and Data Types
• A variable contains a piece of data.
• e.g.: number of records in a database, person’s name,
• PHP is a “loosely typed” language.
• a single variable may contain any type of data.
• e.g.: a number (integer/floating point),
a string of text or Boolean values.
• not need to declare a variable to be a specific data type
• All variables in PHP begin with a $ (dollar sign).
• Variable names are case sensitive.
$name = “Ahmad”; // assign a string “Ahmad” to $name
$x = 45; // assign an integer 45 to $x
1. introduction to php and variable
1. introduction to php and variable

More Related Content

PPTX
Php intro
PPTX
PHP presentation - Com 585
PPTX
Web Application Development using PHP Chapter 1
PPTX
Introduction to webprogramming using PHP and MySQL
PPTX
PHP Training in Chandigarh
PPTX
What is php
PPT
PHP LICTURES ..........
Php intro
PHP presentation - Com 585
Web Application Development using PHP Chapter 1
Introduction to webprogramming using PHP and MySQL
PHP Training in Chandigarh
What is php
PHP LICTURES ..........

Similar to 1. introduction to php and variable (20)

PPT
Intro to PHP for Students and professionals
PPTX
PHP ITCS 323
PDF
PHP in Web development and Applications.pdf
PPTX
PHP stand for PHP Hypertext Preprocessor
PPT
PHP - Introduction to PHP Fundamentals
PPT
PPTX
PPTX
Introduction to PHP.pptx
PDF
Introduction to PHP - Basics of PHP
PPTX
lec1 (1).pptxkeoiwjwoijeoiwjeoijwoeijewoi
PDF
basic concept of php(Gunikhan sonowal)
PPTX
Php unit i
PDF
WT_PHP_PART1.pdf
PPT
Intro to-php-19 jun10
PPTX
php Chapter 1.pptx
PPTX
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
PPT
Php unit i
PPTX
introduction to php and its uses in daily
Intro to PHP for Students and professionals
PHP ITCS 323
PHP in Web development and Applications.pdf
PHP stand for PHP Hypertext Preprocessor
PHP - Introduction to PHP Fundamentals
Introduction to PHP.pptx
Introduction to PHP - Basics of PHP
lec1 (1).pptxkeoiwjwoijeoiwjeoijwoeijewoi
basic concept of php(Gunikhan sonowal)
Php unit i
WT_PHP_PART1.pdf
Intro to-php-19 jun10
php Chapter 1.pptx
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php unit i
introduction to php and its uses in daily
Ad

Recently uploaded (20)

PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Institutional Correction lecture only . . .
PDF
01-Introduction-to-Information-Management.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Cell Types and Its function , kingdom of life
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Microbial diseases, their pathogenesis and prophylaxis
Institutional Correction lecture only . . .
01-Introduction-to-Information-Management.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Anesthesia in Laparoscopic Surgery in India
VCE English Exam - Section C Student Revision Booklet
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
Pharmacology of Heart Failure /Pharmacotherapy of CHF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
FourierSeries-QuestionsWithAnswers(Part-A).pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Final Presentation General Medicine 03-08-2024.pptx
Cell Types and Its function , kingdom of life
Ad

1. introduction to php and variable

  • 1. INTRODUCTION TO PHP Source: Pensyarah Uitm Jasin, Melaka
  • 2. OUTLINE Introduction to Server Side Script01 Introduction to PHP02 Variables and Data Types03
  • 3. How Server Side Script Works Your Text Here request response Web browser/Client Server run server side script run the script generate HTML code Database maybe get some data from database
  • 4. Introduction to PHP • PHP : recursive acronym for "PHP Hypertext Preprocessor“ • Developed in 1995 • Widely-used Open Source scripting language that enables to create interactive web sites and can be embedded into HTML. • PHP provides many great features: • free, easy to learn, fun to use, connects to most databases • provides many levels of security • available on most systems: Windows, Linux, Mac OS, etc • lots of built-in functions
  • 5. Getting PHP to Work Three important components need to be installed on the computer system:  Web server – e.g. Apache (most widely used  free), IIS, PWS  PHP software distribution (parser)  Latest stable release is PHP 4.3.7  PHP version 5 is also available, but this is considered a “release candidate”.  Database – e.g. MySQL (most popular RDBMS used over the Internet  free, fast, flawless), Oracle, Sybase
  • 6. PHP Basic Syntax • All PHP code must be included inside one of these special markup tags: • PHP files must be saved with a php extension, e.g.: .php, .php3 or .php4 • Every statement in PHP must be terminated with a semicolon (;) • PHP is not generally case-sensitive • Characters to indicate Comments: • // or # : single-line comment • /* here is an introduction to server side script code inside a multi-line comment */ : multi-line comment <?php php code goes here ?> <script language=“php”> php code goes here </script>
  • 7. Example 1 Save as exe1.php Output <html> <?php echo “<h1> Hello, World!</h1>”; ?> </html>
  • 8. Variables and Data Types • A variable contains a piece of data. • e.g.: number of records in a database, person’s name, • PHP is a “loosely typed” language. • a single variable may contain any type of data. • e.g.: a number (integer/floating point), a string of text or Boolean values. • not need to declare a variable to be a specific data type • All variables in PHP begin with a $ (dollar sign). • Variable names are case sensitive. $name = “Ahmad”; // assign a string “Ahmad” to $name $x = 45; // assign an integer 45 to $x