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)

PPTX
Php unit i
PPTX
PHP ITCS 323
PPTX
introduction to php and its uses in daily
PPTX
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
PPTX
PHP stand for PHP Hypertext Preprocessor
PPTX
Introduction to PHP.pptx
PDF
web Based Application Devlopment using PHP
PPTX
lec1 (1).pptxkeoiwjwoijeoiwjeoijwoeijewoi
PPT
Php unit i
PDF
Materi Dasar PHP
PPT
Introduction to php
PPTX
Introduction to PHP from Beginning to End
PPT
PPT
PHP - Introduction to PHP Fundamentals
PPTX
INTRODUCTION ON PHP - SERVER SIDE SCRIPTING LANGUAGE
PPT
PHP MySQL Workshop - facehook
PPTX
Introduction to PHP.pptx
PPTX
Php and MySQL final year bca notes for bca.pptx
PPT
Php intro
Php unit i
PHP ITCS 323
introduction to php and its uses in daily
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
PHP stand for PHP Hypertext Preprocessor
Introduction to PHP.pptx
web Based Application Devlopment using PHP
lec1 (1).pptxkeoiwjwoijeoiwjeoijwoeijewoi
Php unit i
Materi Dasar PHP
Introduction to php
Introduction to PHP from Beginning to End
PHP - Introduction to PHP Fundamentals
INTRODUCTION ON PHP - SERVER SIDE SCRIPTING LANGUAGE
PHP MySQL Workshop - facehook
Introduction to PHP.pptx
Php and MySQL final year bca notes for bca.pptx
Php intro
Ad

Recently uploaded (20)

PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Lesson notes of climatology university.
PPTX
Cell Structure & Organelles in detailed.
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Basic Mud Logging Guide for educational purpose
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Complications of Minimal Access Surgery at WLH
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
human mycosis Human fungal infections are called human mycosis..pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
TR - Agricultural Crops Production NC III.pdf
Insiders guide to clinical Medicine.pdf
01-Introduction-to-Information-Management.pdf
Pharma ospi slides which help in ospi learning
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Lesson notes of climatology university.
Cell Structure & Organelles in detailed.
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Basic Mud Logging Guide for educational purpose
GDM (1) (1).pptx small presentation for students
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Complications of Minimal Access Surgery at WLH
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O7-L3 Supply Chain Operations - ICLT Program
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Anesthesia in Laparoscopic Surgery in India
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
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