SlideShare a Scribd company logo
1 of 24
By dharmendra kumar dhakar
Roll no:12115029
NIT RAIPUR
Introduction
Php is stands for php: hypertext pre-processor
Widely used open source scripting language
Server-side scripting language
Embedded with html
 current version of php is 5.5.15 released on 24
july 2014.
What is scripting language
 Scripting languages abstract their users from variable
types and memory management
 no need to compile
 A scripting language is usually interpreted from source
code to bytecode
Client server model of php
Server side scripting
 it is a technique used in web design
 involves embedding script in html source code
 before respond to client , server execute server –side
script and produce equivalent HTML code
 server side scripting is different from client side
scripting. For example javascript runs on brower.
Importance of php in web development
open source
Cross platform architecture
 Intergated with a wider range of database like oracle
mysql ,ms access etc.
It supports various servers like Apache ,IIS etc.
Aache is best suited for executing PHP scripts
PHP program structure
<?php
//php code goes here
?>
 “.php” is default file extension for PHP
 PHP file contains PHP scripting code and HTML tags
Variables in PHP
 Used for storing value
 Can hold any type of value, no data type
 Starts with $ sign and preceded by name of
variable
 name of variable are case sensitive
Built in variable
$_GET-used for retrieving form element ,also used
for fetching value of variable through URL
 $_POST:-HTTP post variable used for retrieving form
element
$_SESSION :-used for creating session variable
$_COOKIE :-used for cookie manipulation
Combining HTML and PHP
<html>
<head></head>
<body>
<?php
echo “hello”;
?>
</body>
</html>
PHP functions
 function keyword is used to create a function
 Syntax
function fun_name(parameter){
//some code
return some_value;
}
PHP ‘include’ and ‘requir’
 used to include content of one file into another
Syntax
<?php include “header.php”;
//some code
include “footer.php”
?>
PHP array
 special variable that can hold multiple values at a time
 Indexed array: array with numeric index
 Associative array: element are accessed by keys instead of
numeric index
 multidimensional array: An array that can contain
another array as value
 array() function is used to create an array cont…
PHP array
 syntax
$arr=array(1,2,3,4,5); //indexed array
$arr=array(1=>2,4=>6,5=>7)//associative array
$a=array(1=>array(1,2,3,4,5))//multidimentiona
l
PHP arrays
 foreach loop:-special loop used for arrays
 syntax to access array element
foreach($arr as $value){
echo $value; //for indexed array
}
 to access element of associative array
PHP array
foreach($arr as $key=>$value)
{
echo “value at”.$key.”is”.$value;
}
 array_pop() function is used to delete the last
element of an array
MYSQL
 Mysql is a database and defines structure for storing
information.
 MYSQL is used to perform database related
operation.
 Can be integrated with php.
 open source database server.
Connecting to mysql
 In PHP connection is established using mysql_connect()
function
 syntax:
mysql_connect(servername,username,database
password);
example:-
<?php
$ conn=mysql_connect(“localhost”,”root”,””)
// some code
?>
Closing MYSQL connection
connection use the mysql_closeTo close the () function
 example
<php $db=mysql_connect(“localhost”,”root”,””);
if(!$db) die(“cannot connet to mysal”);
else
//some code
mysql_close($db);
?>
session
 contains information about same user between different
web pages for a particular application
 session_start() function is used to start session
 $_SESSION variable is used to create session variable
<?php session_start()
$_SESSION[‘uname’]=“shyam”;
?>
session
 session_destroy() function is use to destroy session variable
<?php
session_start();
$_SESSION[‘uname’]=$_POST[‘name’];
// some code
session_destroy() //destroy the session
?>
cookie
 often used to identify user
 cookie is a small file which server embeds on user’s system
 whenever same system request a webpage it sends cookie
too
 creating a cookie
setcookie(‘name’,value’,expire,path,domain,security)
cookie
 $_COOKIE variable is used to retrieve cookie
<?php setcookie(“name”, ”shyam” date()+12*60*60);
echo $_COOKIE[‘name’];
?>
 session is better option of cookie
Php technical presentation

More Related Content

What's hot (20)

Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
Php
PhpPhp
Php
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Lesson 2 php data types
Lesson 2   php data typesLesson 2   php data types
Lesson 2 php data types
 
Php
PhpPhp
Php
 
Php tutorial
Php  tutorialPhp  tutorial
Php tutorial
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Php Ppt
Php PptPhp Ppt
Php Ppt
 
Introduction to xampp
Introduction to xamppIntroduction to xampp
Introduction to xampp
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Php
PhpPhp
Php
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorial
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Php ppt
Php pptPhp ppt
Php ppt
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
Node js
Node jsNode js
Node js
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1
 

Viewers also liked

Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]Mozammel Haque
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPrinceGuru MS
 
Phing: Building with PHP
Phing: Building with PHPPhing: Building with PHP
Phing: Building with PHPhozn
 
PHP presentation - Com 585
PHP presentation - Com 585PHP presentation - Com 585
PHP presentation - Com 585jstout007
 
Technical Seminar PPT
Technical Seminar PPTTechnical Seminar PPT
Technical Seminar PPTKshitiz_Vj
 
SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...
SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...
SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...Empowered Presentations
 
Healthcare Napkins All
Healthcare Napkins AllHealthcare Napkins All
Healthcare Napkins AllDan Roam
 

Viewers also liked (11)

Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
 
Phing: Building with PHP
Phing: Building with PHPPhing: Building with PHP
Phing: Building with PHP
 
PHP presentation - Com 585
PHP presentation - Com 585PHP presentation - Com 585
PHP presentation - Com 585
 
Technical Seminar PPT
Technical Seminar PPTTechnical Seminar PPT
Technical Seminar PPT
 
Shift Happens
Shift HappensShift Happens
Shift Happens
 
THIRST
THIRSTTHIRST
THIRST
 
Foot Notes
Foot NotesFoot Notes
Foot Notes
 
SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...
SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...
SMOKE - The Convenient Truth [1st place Worlds Best Presentation Contest] by ...
 
Healthcare Napkins All
Healthcare Napkins AllHealthcare Napkins All
Healthcare Napkins All
 
Death by PowerPoint
Death by PowerPointDeath by PowerPoint
Death by PowerPoint
 

Similar to Php technical presentation

Similar to Php technical presentation (20)

Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php notes
Php notesPhp notes
Php notes
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
 
Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdf
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
 
Php
PhpPhp
Php
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
Introduction to-php
Introduction to-phpIntroduction to-php
Introduction to-php
 
Php1
Php1Php1
Php1
 
Php1(2)
Php1(2)Php1(2)
Php1(2)
 
PHP
PHPPHP
PHP
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php1
Php1Php1
Php1
 
chapter Two Server-side Script lang.pptx
chapter  Two Server-side Script lang.pptxchapter  Two Server-side Script lang.pptx
chapter Two Server-side Script lang.pptx
 
PHP MySQL Workshop - facehook
PHP MySQL Workshop - facehookPHP MySQL Workshop - facehook
PHP MySQL Workshop - facehook
 
Php1
Php1Php1
Php1
 

Recently uploaded

SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Recently uploaded (20)

SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 

Php technical presentation

  • 1. By dharmendra kumar dhakar Roll no:12115029 NIT RAIPUR
  • 2. Introduction Php is stands for php: hypertext pre-processor Widely used open source scripting language Server-side scripting language Embedded with html  current version of php is 5.5.15 released on 24 july 2014.
  • 3. What is scripting language  Scripting languages abstract their users from variable types and memory management  no need to compile  A scripting language is usually interpreted from source code to bytecode
  • 5. Server side scripting  it is a technique used in web design  involves embedding script in html source code  before respond to client , server execute server –side script and produce equivalent HTML code  server side scripting is different from client side scripting. For example javascript runs on brower.
  • 6. Importance of php in web development open source Cross platform architecture  Intergated with a wider range of database like oracle mysql ,ms access etc. It supports various servers like Apache ,IIS etc. Aache is best suited for executing PHP scripts
  • 7. PHP program structure <?php //php code goes here ?>  “.php” is default file extension for PHP  PHP file contains PHP scripting code and HTML tags
  • 8. Variables in PHP  Used for storing value  Can hold any type of value, no data type  Starts with $ sign and preceded by name of variable  name of variable are case sensitive
  • 9. Built in variable $_GET-used for retrieving form element ,also used for fetching value of variable through URL  $_POST:-HTTP post variable used for retrieving form element $_SESSION :-used for creating session variable $_COOKIE :-used for cookie manipulation
  • 10. Combining HTML and PHP <html> <head></head> <body> <?php echo “hello”; ?> </body> </html>
  • 11. PHP functions  function keyword is used to create a function  Syntax function fun_name(parameter){ //some code return some_value; }
  • 12. PHP ‘include’ and ‘requir’  used to include content of one file into another Syntax <?php include “header.php”; //some code include “footer.php” ?>
  • 13. PHP array  special variable that can hold multiple values at a time  Indexed array: array with numeric index  Associative array: element are accessed by keys instead of numeric index  multidimensional array: An array that can contain another array as value  array() function is used to create an array cont…
  • 14. PHP array  syntax $arr=array(1,2,3,4,5); //indexed array $arr=array(1=>2,4=>6,5=>7)//associative array $a=array(1=>array(1,2,3,4,5))//multidimentiona l
  • 15. PHP arrays  foreach loop:-special loop used for arrays  syntax to access array element foreach($arr as $value){ echo $value; //for indexed array }  to access element of associative array
  • 16. PHP array foreach($arr as $key=>$value) { echo “value at”.$key.”is”.$value; }  array_pop() function is used to delete the last element of an array
  • 17. MYSQL  Mysql is a database and defines structure for storing information.  MYSQL is used to perform database related operation.  Can be integrated with php.  open source database server.
  • 18. Connecting to mysql  In PHP connection is established using mysql_connect() function  syntax: mysql_connect(servername,username,database password); example:- <?php $ conn=mysql_connect(“localhost”,”root”,””) // some code ?>
  • 19. Closing MYSQL connection connection use the mysql_closeTo close the () function  example <php $db=mysql_connect(“localhost”,”root”,””); if(!$db) die(“cannot connet to mysal”); else //some code mysql_close($db); ?>
  • 20. session  contains information about same user between different web pages for a particular application  session_start() function is used to start session  $_SESSION variable is used to create session variable <?php session_start() $_SESSION[‘uname’]=“shyam”; ?>
  • 21. session  session_destroy() function is use to destroy session variable <?php session_start(); $_SESSION[‘uname’]=$_POST[‘name’]; // some code session_destroy() //destroy the session ?>
  • 22. cookie  often used to identify user  cookie is a small file which server embeds on user’s system  whenever same system request a webpage it sends cookie too  creating a cookie setcookie(‘name’,value’,expire,path,domain,security)
  • 23. cookie  $_COOKIE variable is used to retrieve cookie <?php setcookie(“name”, ”shyam” date()+12*60*60); echo $_COOKIE[‘name’]; ?>  session is better option of cookie