SlideShare a Scribd company logo
PHP
 PHP stands for Hypertext PreProcessor.
 PHP is a server side scripting language that is
embedded in HTML.
 PHP allows web developers to create dynamic
web pages.
 It is integrated with a number of popular
databases, including MySQL, PostgreSQL,
Oracle, Sybase, Informix and SQL Server.
 PHP was written in the C programming language
by Rasmus Lerdorf in 1994.
 PHP originally stood for “Personal Home Page”.
 Simplicity
 Efficiency
 Security
 Flexibility
 PHP code must be included inside one of the 3
special markup tags:
<?php PHP CODE HERE ?>
<? PHP CODE HERE ?>
<script language=“php”>
PHP CODE HERE
</script>
<html>
<head>
<title>Sample PHP</title>
</head>
<body>
<h1>
<?php echo "Hello PHP Developers"; ?>
</h1>
</body>
</html>
 Variables are used to store the data.
 Here are the most important things about
variables in PHP:
i. All variables are denoted with a leading dollar
sign($).
ii. Variables do not have intrinsic types.
iii. PHP does a good job of automatically converting
types from one to another when necessary.
 PHP variables can be one of four scope types:
i. Local variables
ii. Function parameters
iii. Global variables
iv. Static variables
 A constant is a name or an identifier for a simple
value.
 A constant value cannot change during the execution
of the script.
 To define a constant you have to use define()
function and to retrieve the value of a constant.
 You can also use the function constant() to read a
constant’s value.
 PHP has 8 datatypes:
i. Integers
ii. Doubles
iii. Booleans
iv. NULL
v. Strings
vi. Arrays
vii. Objects
viii. Resources
 n is replaced by the newline character
 r is replaced by the carriage-return character
 t is replaced by the tab character
 $ is replaced by the dollar sign itself ($)
 " is replaced by a single double-quote (")
  is replaced by a single backslash ()
 Arithmetic Operators(+,-,*,/,%,++,--)
 Comparison Operators(==,!=,>,<,>=,<=)
 Logical or Relational Operators(and,or,&&,||,!)
 Assignment Operators(=,+=,-=,*=,/=,%=)
 Conditional or Ternary Operators( ?: )
PHP
PHP
 if-else Statement
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
 elseif Statement
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
 Switch Statement
switch (expression)
{
case label1:
code to be executed if expression = label1;
break;
case label2:
code to be executed if expression = label2;
break;
default:
code to be executed if expression is different from
above labels;
}
 for Statement
for (initialization; condition; updation)
{
code to be executed;
}
 while Statement
while (condition)
{
code to be executed;
}
 do-while Statement
do
{
code to be executed;
}
while (condition);
 foreach Statement
foreach (array as value)
{
code to be executed;
}
 An array is a data structure that stores one or
more type of values in a single variable.
 Types of Arrays:
i. Numeric Array
ii. Associative Array
iii. Multidimensional Array
 These arrays can store numbers, strings and any
object.
 Here we have used array() function to create
array.
 Associative array will have their index as string
so that you can establish a strong association
between key and values.
Creating Array:
$array_name=array(“str1”=>value1,
“str2”=>value2, ……
“strn”=>valuen);
Accessing Array Elements:
$array_name[‘str1’];
 A multi-dimensional array each element in the
main array can also be an array and each element
in the sub-array can be an array and so on.
 A function is a piece of code which takes one or
more input in the form of parameter and does
some processing and returns a value.
 Creating Function
function function_name(parameters list)
{
/* Code Here */
}
 Calling Function
function_name(parameters list);
 Cookies are text files stored on the client computer
and they are kept of use tracking purpose.
 There are 3 steps involved in identifying returning
users:
i. Server script sends a set of cookies to the browser.
ii. Browser stores this information on local machine for
future use.
iii. Next time, when the browser sends any request to the
web server, it sends those cookies information to the
server and server uses that information to identify the
user.
 PHP provided setcookie() function to set a cookie.
setcookie(name,value,expire,path,domain,security);
 To access cookies, use either $_COOKIE[name] or
$HTTP_COOKIE_VARS[name] variables.
 You can use isset() function to check if a cookie is set or
not.
CONNECTING TO MYSQL DATABASE
Opening a Database Connection
connection mysql_connect(dbserver, user, password,
new_link, client_flag);
Closing Database Connection
bool mysql_close(resource $link_identifier);
Selecting a Database
$retval=bool mysql_select_db(dn_name,connection);
Creating a Database/Executing Query
bool mysql_query(sql,connection);
Retrieving Data from Database
mysql_fetch_array($retval, type_array);
mysql_fetch_assoc($retval);

More Related Content

ODP
Shapeless- Generic programming for Scala
PPTX
Developer’s viewpoint on swift programming language
PPTX
Javascript Basics
PPTX
Strings in programming tutorial.
ODP
String Interpolation in Scala
PPT
JavaScript Data Types
Shapeless- Generic programming for Scala
Developer’s viewpoint on swift programming language
Javascript Basics
Strings in programming tutorial.
String Interpolation in Scala
JavaScript Data Types

What's hot (20)

PPTX
Basic iOS Training with SWIFT - Part 2
PDF
2 variables and data types
PPTX
function, storage class and array and strings
PPT
Strings in c
PDF
Introduction to C++
PPTX
Strings in c++
PPT
Polymorphism
PDF
Swift Study #3
PPSX
DIWE - Advanced PHP Concepts
PPT
Javascript
PPTX
Compiler: Programming Language= Assignments and statements
PPTX
Strings in C
PPTX
ASSIGNMENT STATEMENTS AND
PPTX
Complete Notes on Angular 2 and TypeScript
PPSX
Javascript variables and datatypes
PPT
Javascript
PPT
DOC
String in c
PPSX
Esoft Metro Campus - Certificate in c / c++ programming
PPTX
Data types in php
Basic iOS Training with SWIFT - Part 2
2 variables and data types
function, storage class and array and strings
Strings in c
Introduction to C++
Strings in c++
Polymorphism
Swift Study #3
DIWE - Advanced PHP Concepts
Javascript
Compiler: Programming Language= Assignments and statements
Strings in C
ASSIGNMENT STATEMENTS AND
Complete Notes on Angular 2 and TypeScript
Javascript variables and datatypes
Javascript
String in c
Esoft Metro Campus - Certificate in c / c++ programming
Data types in php
Ad

Similar to PHP (20)

PPT
Training on php by cyber security infotech (csi)
DOC
php&mysql with Ethical Hacking
PDF
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
PPTX
Lecture3 php by okello erick
PPTX
FYBSC IT Web Programming Unit IV PHP and MySQL
PDF
Lecture17 ie321 dr_atifshahzad_js
PPT
Introduction To Php For Wit2009
PDF
lab4_php
PDF
lab4_php
PDF
Web app development_php_04
PPTX
unit 1.pptx
PPTX
Learn PHP Basics
PDF
PHP Reviewer
DOCX
Php interview questions
PPT
Ajax and JavaScript Bootcamp
PPT
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
PPT
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
PPT
Php i basic chapter 3
Training on php by cyber security infotech (csi)
php&mysql with Ethical Hacking
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Lecture3 php by okello erick
FYBSC IT Web Programming Unit IV PHP and MySQL
Lecture17 ie321 dr_atifshahzad_js
Introduction To Php For Wit2009
lab4_php
lab4_php
Web app development_php_04
unit 1.pptx
Learn PHP Basics
PHP Reviewer
Php interview questions
Ajax and JavaScript Bootcamp
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3
Ad

More from Govardhan Bhavani (16)

PPTX
Angular Application Setup.pptx
PPTX
Files.pptx
PPTX
Pandas.pptx
PPTX
NumPy.pptx
PPTX
ExpressJS and REST API.pptx
PPTX
NodeJS.pptx
PPTX
Angular.pptx
PPTX
JavaScript.pptx
PPTX
Maven.pptx
PPTX
Configure & Version Control-Git.pptx
PPTX
DevOps.pptx
PPTX
Agile XP.pptx
PPTX
Unit 1part-2 forms & frames
PPTX
Unit 1 (part-1, basic tags)
Angular Application Setup.pptx
Files.pptx
Pandas.pptx
NumPy.pptx
ExpressJS and REST API.pptx
NodeJS.pptx
Angular.pptx
JavaScript.pptx
Maven.pptx
Configure & Version Control-Git.pptx
DevOps.pptx
Agile XP.pptx
Unit 1part-2 forms & frames
Unit 1 (part-1, basic tags)

Recently uploaded (20)

PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Cell Types and Its function , kingdom of life
PDF
Complications of Minimal Access Surgery at WLH
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Lesson notes of climatology university.
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
master seminar digital applications in india
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Weekly quiz Compilation Jan -July 25.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
History, Philosophy and sociology of education (1).pptx
A systematic review of self-coping strategies used by university students to ...
Cell Types and Its function , kingdom of life
Complications of Minimal Access Surgery at WLH
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Microbial diseases, their pathogenesis and prophylaxis
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Chinmaya Tiranga quiz Grand Finale.pdf
Lesson notes of climatology university.
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Orientation - ARALprogram of Deped to the Parents.pptx
LDMMIA Reiki Yoga Finals Review Spring Summer
Paper A Mock Exam 9_ Attempt review.pdf.
master seminar digital applications in india

PHP

  • 2.  PHP stands for Hypertext PreProcessor.  PHP is a server side scripting language that is embedded in HTML.  PHP allows web developers to create dynamic web pages.  It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix and SQL Server.
  • 3.  PHP was written in the C programming language by Rasmus Lerdorf in 1994.  PHP originally stood for “Personal Home Page”.
  • 4.  Simplicity  Efficiency  Security  Flexibility
  • 5.  PHP code must be included inside one of the 3 special markup tags: <?php PHP CODE HERE ?> <? PHP CODE HERE ?> <script language=“php”> PHP CODE HERE </script>
  • 6. <html> <head> <title>Sample PHP</title> </head> <body> <h1> <?php echo "Hello PHP Developers"; ?> </h1> </body> </html>
  • 7.  Variables are used to store the data.  Here are the most important things about variables in PHP: i. All variables are denoted with a leading dollar sign($). ii. Variables do not have intrinsic types. iii. PHP does a good job of automatically converting types from one to another when necessary.
  • 8.  PHP variables can be one of four scope types: i. Local variables ii. Function parameters iii. Global variables iv. Static variables
  • 9.  A constant is a name or an identifier for a simple value.  A constant value cannot change during the execution of the script.  To define a constant you have to use define() function and to retrieve the value of a constant.  You can also use the function constant() to read a constant’s value.
  • 10.  PHP has 8 datatypes: i. Integers ii. Doubles iii. Booleans iv. NULL v. Strings vi. Arrays vii. Objects viii. Resources
  • 11.  n is replaced by the newline character  r is replaced by the carriage-return character  t is replaced by the tab character  $ is replaced by the dollar sign itself ($)  " is replaced by a single double-quote (")  is replaced by a single backslash ()
  • 12.  Arithmetic Operators(+,-,*,/,%,++,--)  Comparison Operators(==,!=,>,<,>=,<=)  Logical or Relational Operators(and,or,&&,||,!)  Assignment Operators(=,+=,-=,*=,/=,%=)  Conditional or Ternary Operators( ?: )
  • 15.  if-else Statement if (condition) code to be executed if condition is true; else code to be executed if condition is false;
  • 16.  elseif Statement if (condition) code to be executed if condition is true; elseif (condition) code to be executed if condition is true; else code to be executed if condition is false;
  • 17.  Switch Statement switch (expression) { case label1: code to be executed if expression = label1; break; case label2: code to be executed if expression = label2; break; default: code to be executed if expression is different from above labels; }
  • 18.  for Statement for (initialization; condition; updation) { code to be executed; }
  • 19.  while Statement while (condition) { code to be executed; }
  • 20.  do-while Statement do { code to be executed; } while (condition);
  • 21.  foreach Statement foreach (array as value) { code to be executed; }
  • 22.  An array is a data structure that stores one or more type of values in a single variable.  Types of Arrays: i. Numeric Array ii. Associative Array iii. Multidimensional Array
  • 23.  These arrays can store numbers, strings and any object.  Here we have used array() function to create array.
  • 24.  Associative array will have their index as string so that you can establish a strong association between key and values. Creating Array: $array_name=array(“str1”=>value1, “str2”=>value2, …… “strn”=>valuen); Accessing Array Elements: $array_name[‘str1’];
  • 25.  A multi-dimensional array each element in the main array can also be an array and each element in the sub-array can be an array and so on.
  • 26.  A function is a piece of code which takes one or more input in the form of parameter and does some processing and returns a value.  Creating Function function function_name(parameters list) { /* Code Here */ }  Calling Function function_name(parameters list);
  • 27.  Cookies are text files stored on the client computer and they are kept of use tracking purpose.  There are 3 steps involved in identifying returning users: i. Server script sends a set of cookies to the browser. ii. Browser stores this information on local machine for future use. iii. Next time, when the browser sends any request to the web server, it sends those cookies information to the server and server uses that information to identify the user.
  • 28.  PHP provided setcookie() function to set a cookie. setcookie(name,value,expire,path,domain,security);  To access cookies, use either $_COOKIE[name] or $HTTP_COOKIE_VARS[name] variables.  You can use isset() function to check if a cookie is set or not.
  • 29. CONNECTING TO MYSQL DATABASE Opening a Database Connection connection mysql_connect(dbserver, user, password, new_link, client_flag); Closing Database Connection bool mysql_close(resource $link_identifier);
  • 30. Selecting a Database $retval=bool mysql_select_db(dn_name,connection); Creating a Database/Executing Query bool mysql_query(sql,connection); Retrieving Data from Database mysql_fetch_array($retval, type_array); mysql_fetch_assoc($retval);