SlideShare a Scribd company logo
1 of 24
Download to read offline
www.northpolewebservice.com
www.northpolewebservice.com
ā€œPHP is a server-side scripting language designed specifically for the Web.
Within an HTML page, you can embed PHP code that will be executed each
time the page is visited. Your PHP code is interpreted at the Web server and
generates HTML or other output that the visitor will seeā€ (ā€œPHP and MySQL
Web Developmentā€, Luke Welling and Laura Thomson, SAMS)
Introduction to PHP
www.northpolewebservice.com
ā— 1994: Created by Rasmis Lesdorf, software engineer (part of Apache Team)
ā— 1995: Called Personal Home Page Tool, then released as version 2 with
name PHP/FI (Form Interpreter, to analyze SQL queries)
ā— Half 1997: used by 50,000 web sites
ā— October 1998: used by 100,000 websites
ā— End 1999: used by 1,000,000 websites
PHP History
www.northpolewebservice.com
Alternatives to PHP
ā— Practical extraction and Report Language (Perl)
ā— Active Server Pages (ASP)
ā— Java server pages (JSP)
ā— Ruby
www.northpolewebservice.com
How PHP generates
HTML/JS Web pages
2
Client
Browser
1 PHP
module
3
4
Apache
1: Client from browser send HTTP request (with POST/GET
variables)
2: Apache recognizes that a PHP script is requested and sends the
request to PHP module
3: PHP interpreter executes PHP script, collects script output and
sends it back
4: Apache replies to client using the PHP script output as HTML
output
www.northpolewebservice.com
Hello World! (web oriented)
<html>
<head>
<title>My personal Hello World! PHP script</title>
</head>
<body>
<?
echo ā€œHello World!ā€;
?>
</html>
PHP tag, allow to insert PHP
code. Interpretation by PHP
module will substitute the code
with code output
www.northpolewebservice.com
Example of PHP :
ļ‚— <!DOCTYPE html>
<html>
<body>
<?php
echo "My first PHP
script!";
?>
</body>
</html>
Output:
My first PHP script!
www.northpolewebservice.com
PHP echo and print statements:-
ā€¢echo and print are more or less the same. They are both
used to output data to the screen.
ā€¢The differences are small: echo has no return value
while print has a return value of 1 so it can be used in
expressions. echo can take multiple parameters
(although such usage is rare) while print can take one
argument. echo is marginally faster than print.
www.northpolewebservice.com
Example of echo statements:
ļ‚— <!DOCTYPE html>
<html>
<body>
<?php
echo "<h2>PHP is
Fun!</h2>";
echo "Hello world!<br>";
echo "I'm about to learn
PHP!<br>";
echo "This ", "string ", "was
", "made ", "with multiple
parameters.";
?>
< >/body
</html>
ļ‚— Output:
PHP is Fun!
Hello world!
I'm about to learn PHP!
This string was made with
multiple parameters.
www.northpolewebservice.com
Example of print statements:
ļ‚— <!DOCTYPE html>
<html>
<body>
?php<
print "<h2>PHP is
Fun!</h2>";
print "Hello world!<br>";
print "I'm about to learn
PHP!";
?>
</body>
< >/html
ļ‚— Output:
PHP is Fun!
Hello world!
I'm about to learn PHP!
www.northpolewebservice.com
PHP Operators
Operators are used to operate on values. There are
four classifications of operators:
> Arithmetic
> Assignment
> Comparison
> Logical
www.northpolewebservice.com
PHP Operators
www.northpolewebservice.com
PHP Conditional Statements
ā€¢> if statement - use this statement to execute some code
only if a specified condition is true
ā€¢> if...else statement - use this statement to execute some
code if a condition is true and another code if the
condition is false
ā€¢> if...elseif....else statement - use this statement to select
one of several blocks of code to be executed
ā€¢> switch statement - use this statement to select one of
many blocks of code to be executed
www.northpolewebservice.com
ā€¢Use the if....else statement to execute some code if a
condition is true and another code if a condition is
false.
www.northpolewebservice.com
Arrays (I)
ā€¢ Groups a set of variables, every element stored into an array as an
associated key (index to retrieve the element)
$books = array( 0=>ā€php manualā€,1=>ā€perl manualā€,2=>ā€C manualā€);
$books = array( 0=>ā€php manualā€,ā€perl manualā€,ā€C manualā€);
$books = array (ā€œphp manualā€,ā€perl manualā€,ā€C manualā€);
echo $books[2]; output: C manual
ā€¢ Arrays with PHP are associative
$books = array( ā€œphp manualā€=>1,ā€perl manualā€=>1,ā€C manualā€=>1); // HASH
echo $books[ā€œperl manualā€]; output: 1
$books[ā€œlisp manualā€] = 1; // Add a new element
www.northpolewebservice.com
Arrays (II)
ā€¢ Working on an arrays
$books = array( ā€php manualā€,ā€perl manualā€,ā€C manualā€);
ā€¢ Common loop
for ($i=0; $i < count($books); $i++)
print ($i+1).ā€-st book of my library: $books[$i]ā€;
ā€¢ each
$books = array( ā€œphp manualā€=>1,ā€perl manualā€=>2,ā€C manualā€=>3);
while ($item = each( $books )) // Retrieve items one by one
print $item[ā€œvalueā€].ā€-st book of my library: ā€.$item[ā€œkeyā€];
// each retrieve an array of two elements with key and value of current element
ā€¢ each and list
while ( list($value,$key) = each( $books ))
print ā€œ$value-st book of my library: $keyā€;
// list collect the two element retrieved by each and store them in two
different // variables
www.northpolewebservice.com
Arrays (III)
ā€¢ Multidimensional arrays
$books = array( array(ā€œtitleā€=>ā€œphp manualā€,ā€editorā€=>ā€Xā€,ā€authorā€=>ā€Aā€),
array(ā€œtitleā€=>ā€œperl manualā€,ā€editorā€=>ā€Yā€,ā€authorā€=>ā€Bā€),
array(ā€œtitle=>ā€œC manualā€,ā€editorā€=>ā€Zā€,author=>ā€Cā€));
ā€¢ Common loop
for ($i=0; $i < count($books); $i++ )
print ā€œ$i-st book, title: ā€.$books[$i][ā€œtitleā€].ā€ author: ā€œ.$books[$i][ā€œauthorā€].
ā€œ editor: ā€œ.$books[$i][ā€œeditorā€];
// Add .ā€nā€ for text new page or ā€œ.<BR>ā€ for HTML new page;
ā€¢ Use list and each
for ($i=0; $i < count($books); $i++)
{
print ā€œ$i-st book is: ā€œ;
while ( list($key,$value) = each( $books[$i] ))
print ā€œ$key: $value ā€;
print ā€œ<BR>ā€; // or ā€œnā€
}
www.northpolewebservice.com
Object Oriented PHP
ā€¢ Encapsulation
ā€¢ Polymorphism
ā€¢ Inheritance
ā€¢ Multiple Inheritance: actually unsupported
www.northpolewebservice.com
Encapsulation
<?
class dayOfWeek {
var $day,$month,$year;
function dayOfWeek($day,$month,$year)
{
$this->day = $day;
$this->month = $month;
$this->year = $year;
}
function calculate(){
if ($this->month==1){
$monthTmp=13;
$yearTmp = $this->year - 1;
}
if ($this->month == 2){
$monthTmp = 14;
$yearTmp = $this->year - 1;
}
$val4 = (($month+1)*3)/5;
$val5 = $year/4;
$val6 = $year/100;
$val7 = $year/400;
$val8 = $day+($month*2)+$val4+$val3+$val5-
$val6+$val7+2;
$val9 = $val8/7;
$val0 = $val8-($val9*7);
return $val0;
}
}
// Main
$instance =
new
dayOfWeek($_GET[ā€œdayā€],$_GET[ā€œweekā€],$
_GET[ā€œ monthā€]);
print ā€œYou born on ā€œ.$instance->calculate().ā€nā€;
?>
www.northpolewebservice.com
Inheritance
Allow the creation of a hierarchy of classes
Class reuseMe {
function
reuseMe(){...}
function
doTask1(){...}
function
doTask2(){...}
function
doTask3(){...}
}
Class extends reuseMe {
function example(){
... // local initializations
// call super constructor
reuseMe::reuseMe();
}
function doTask4(){...}
function doTask5(){...}
function doTask6(){...}
}
www.northpolewebservice.com
Polymorphism
A member function can override superclass
implementation. Allow each subclass to
reimplement a common interfaces.
class reuseMe {
function
reuseMe(){...}
function
doTask1(){...}
function
doTask2(){...}
function
doTask3(){...}
}
Class extends reuseMe {
function example(){
... // local initializations
// call super constructor
reuseMe::reuseMe();
}
function doTask4(){...}
function doTask5(){...}
function doTask6(){...}
function doTask3(){...}
}
www.northpolewebservice.com
Multiple Inheritance not actually supported by
PHP
class reuseMe1 {
function reuseMe1(){...}
function doTask1(){...}
function doTask2(){...}
function doTask3(){...}
}
class reuseMe2 {
function reuseMe2(){...}
function doTask3(){...}
function doTask4(){...}
function doTask5(){...}
}
class extends reuseMe1,reuseMe2 {...}
www.northpolewebservice.com
Contact us:- To find out more or how we can help you better
Address:- C-127 ,2nd Floor, Ozi gym Building , Phase 8, Industrial Area,
Mohali, 160055
Phone no:- (+91) 8872155107, 9779127768, 8360890672
Email:- npolewebservice@gmail.com
www.northpolewebservice.com

More Related Content

What's hot

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)Muhamad Al Imran
Ā 
Loops PHP 04
Loops PHP 04Loops PHP 04
Loops PHP 04Spy Seat
Ā 
Thymeleaf Introduction
Thymeleaf IntroductionThymeleaf Introduction
Thymeleaf IntroductionAnthony Chen
Ā 
4.2 PHP Function
4.2 PHP Function4.2 PHP Function
4.2 PHP FunctionJalpesh Vasa
Ā 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
Ā 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHPShweta A
Ā 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.jssouridatta
Ā 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit universityMandakini Kumari
Ā 
What Is Php
What Is PhpWhat Is Php
What Is PhpAVC
Ā 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Adam Tomat
Ā 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDBOpusVL
Ā 
php (Hypertext Preprocessor)
php (Hypertext Preprocessor)php (Hypertext Preprocessor)
php (Hypertext Preprocessor)Chandan Das
Ā 
RESTful web services
RESTful web servicesRESTful web services
RESTful web servicesTudor Constantin
Ā 

What's hot (19)

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)
Ā 
PHP for hacks
PHP for hacksPHP for hacks
PHP for hacks
Ā 
Php
PhpPhp
Php
Ā 
Php mysql
Php mysqlPhp mysql
Php mysql
Ā 
Php Basics
Php BasicsPhp Basics
Php Basics
Ā 
Loops PHP 04
Loops PHP 04Loops PHP 04
Loops PHP 04
Ā 
Thymeleaf Introduction
Thymeleaf IntroductionThymeleaf Introduction
Thymeleaf Introduction
Ā 
4.2 PHP Function
4.2 PHP Function4.2 PHP Function
4.2 PHP Function
Ā 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
Ā 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
Ā 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.js
Ā 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
Ā 
What Is Php
What Is PhpWhat Is Php
What Is Php
Ā 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018
Ā 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
Ā 
php (Hypertext Preprocessor)
php (Hypertext Preprocessor)php (Hypertext Preprocessor)
php (Hypertext Preprocessor)
Ā 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
Ā 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
Ā 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
Ā 

Similar to Php converted pdf

Php course-in-navimumbai
Php course-in-navimumbaiPhp course-in-navimumbai
Php course-in-navimumbaivibrantuser
Ā 
Prersentation
PrersentationPrersentation
PrersentationAshwin Deora
Ā 
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...anshkhurana01
Ā 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckrICh morrow
Ā 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
Ā 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
Ā 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3Muhamad Al Imran
Ā 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbaivibrantuser
Ā 
Intro to php
Intro to phpIntro to php
Intro to phpAhmed Farag
Ā 
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting languageElmer Concepcion Jr.
Ā 

Similar to Php converted pdf (20)

Basics PHP
Basics PHPBasics PHP
Basics PHP
Ā 
Php introduction
Php introductionPhp introduction
Php introduction
Ā 
Php course-in-navimumbai
Php course-in-navimumbaiPhp course-in-navimumbai
Php course-in-navimumbai
Ā 
Prersentation
PrersentationPrersentation
Prersentation
Ā 
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...
Ā 
Lecture8
Lecture8Lecture8
Lecture8
Ā 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
Ā 
PHP MySQL Workshop - facehook
PHP MySQL Workshop - facehookPHP MySQL Workshop - facehook
PHP MySQL Workshop - facehook
Ā 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
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 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Ā 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
Ā 
php basics
php basicsphp basics
php basics
Ā 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
Ā 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
Ā 
PHP
PHPPHP
PHP
Ā 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbai
Ā 
Intro to php
Intro to phpIntro to php
Intro to php
Ā 
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting language
Ā 
Php intro
Php introPhp intro
Php intro
Ā 
Php intro
Php introPhp intro
Php intro
Ā 

More from Northpole Web Service (12)

Ppt php
Ppt phpPpt php
Ppt php
Ā 
SEO ppt
SEO pptSEO ppt
SEO ppt
Ā 
Email Marketing Pdf
Email Marketing PdfEmail Marketing Pdf
Email Marketing Pdf
Ā 
E mail marketing
E mail marketingE mail marketing
E mail marketing
Ā 
Ppc pdf
Ppc pdfPpc pdf
Ppc pdf
Ā 
Ppc
PpcPpc
Ppc
Ā 
Framework
FrameworkFramework
Framework
Ā 
Framework PPT
Framework PPTFramework PPT
Framework PPT
Ā 
Google Ad Words
Google Ad Words Google Ad Words
Google Ad Words
Ā 
graphic designing
graphic designing graphic designing
graphic designing
Ā 
Software Testing Presentation
Software Testing PresentationSoftware Testing Presentation
Software Testing Presentation
Ā 
Hybrid mobile application
Hybrid mobile applicationHybrid mobile application
Hybrid mobile application
Ā 

Recently uploaded

Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”
Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”
Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”Lipikasharma29
Ā 
Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”
Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”
Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”thapagita
Ā 
Best VIP Call Girl Noida Sector 48 Call Me: 8700611579
Best VIP Call Girl Noida Sector 48 Call Me: 8700611579Best VIP Call Girl Noida Sector 48 Call Me: 8700611579
Best VIP Call Girl Noida Sector 48 Call Me: 8700611579diyaspanoida
Ā 
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...aakahthapa70
Ā 
Best VIP Call Girls Noida Sector 24 Call Me: 8700611579
Best VIP Call Girls Noida Sector 24 Call Me: 8700611579Best VIP Call Girls Noida Sector 24 Call Me: 8700611579
Best VIP Call Girls Noida Sector 24 Call Me: 8700611579diyaspanoida
Ā 
Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712
Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712
Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712Delhi Escorts Service
Ā 
9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available
9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available
9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Availablenitugupta1209
Ā 
BHOPAL CALL GIRL 92628*71154 BHOPAL CALL
BHOPAL CALL GIRL 92628*71154 BHOPAL CALLBHOPAL CALL GIRL 92628*71154 BHOPAL CALL
BHOPAL CALL GIRL 92628*71154 BHOPAL CALLNiteshKumar82226
Ā 
Best VIP Call Girls Noida Sector 23 Call Me: 8700611579
Best VIP Call Girls Noida Sector 23 Call Me: 8700611579Best VIP Call Girls Noida Sector 23 Call Me: 8700611579
Best VIP Call Girls Noida Sector 23 Call Me: 8700611579diyaspanoida
Ā 
DIGHA CALL GIRL 92628/1154 DIGHA CALL GI
DIGHA CALL GIRL 92628/1154 DIGHA CALL GIDIGHA CALL GIRL 92628/1154 DIGHA CALL GI
DIGHA CALL GIRL 92628/1154 DIGHA CALL GINiteshKumar82226
Ā 
ENJOY Call Girls In Anand Niketan Delhi Call 8826158885
ENJOY Call Girls In Anand Niketan Delhi Call 8826158885ENJOY Call Girls In Anand Niketan Delhi Call 8826158885
ENJOY Call Girls In Anand Niketan Delhi Call 8826158885teencall080
Ā 
Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...
Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...
Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...aakahthapa70
Ā 
Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...
Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...
Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...aakahthapa70
Ā 
NAGPUR CALL GIRL 92628*71154 NAGPUR CALL
NAGPUR CALL GIRL 92628*71154 NAGPUR CALLNAGPUR CALL GIRL 92628*71154 NAGPUR CALL
NAGPUR CALL GIRL 92628*71154 NAGPUR CALLNiteshKumar82226
Ā 
RAJKOT CALL GIRLS 92628/71154 RAJKOT CAL
RAJKOT CALL GIRLS 92628/71154 RAJKOT CALRAJKOT CALL GIRLS 92628/71154 RAJKOT CAL
RAJKOT CALL GIRLS 92628/71154 RAJKOT CALNiteshKumar82226
Ā 
NASHIK CALL GIRL 92628*71154 NASHIK CALL
NASHIK CALL GIRL 92628*71154 NASHIK CALLNASHIK CALL GIRL 92628*71154 NASHIK CALL
NASHIK CALL GIRL 92628*71154 NASHIK CALLNiteshKumar82226
Ā 
JABALPUR CALL GIRL 92628/71154 JABALPUR K
JABALPUR CALL GIRL 92628/71154 JABALPUR KJABALPUR CALL GIRL 92628/71154 JABALPUR K
JABALPUR CALL GIRL 92628/71154 JABALPUR KNiteshKumar82226
Ā 
100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...
100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...
100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...Delhi Escorts Service
Ā 

Recently uploaded (20)

Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”
Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”
Call Girls in Janakpuri Delhi šŸ’Æ Call Us šŸ”9667422720šŸ”
Ā 
Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”
Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”
Call Girls in Majnu ka Tilla Delhi šŸ’Æ Call Us šŸ”9711014705šŸ”
Ā 
Best VIP Call Girl Noida Sector 48 Call Me: 8700611579
Best VIP Call Girl Noida Sector 48 Call Me: 8700611579Best VIP Call Girl Noida Sector 48 Call Me: 8700611579
Best VIP Call Girl Noida Sector 48 Call Me: 8700611579
Ā 
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Ā 
Best VIP Call Girls Noida Sector 24 Call Me: 8700611579
Best VIP Call Girls Noida Sector 24 Call Me: 8700611579Best VIP Call Girls Noida Sector 24 Call Me: 8700611579
Best VIP Call Girls Noida Sector 24 Call Me: 8700611579
Ā 
Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712
Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712
Call Girls In Sector 90, (Gurgaon) Call Us. 9711911712
Ā 
9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available
9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available
9811611494,Low Rate Call Girls In Connaught Place Delhi 24hrs Available
Ā 
BHOPAL CALL GIRL 92628*71154 BHOPAL CALL
BHOPAL CALL GIRL 92628*71154 BHOPAL CALLBHOPAL CALL GIRL 92628*71154 BHOPAL CALL
BHOPAL CALL GIRL 92628*71154 BHOPAL CALL
Ā 
Best VIP Call Girls Noida Sector 23 Call Me: 8700611579
Best VIP Call Girls Noida Sector 23 Call Me: 8700611579Best VIP Call Girls Noida Sector 23 Call Me: 8700611579
Best VIP Call Girls Noida Sector 23 Call Me: 8700611579
Ā 
DIGHA CALL GIRL 92628/1154 DIGHA CALL GI
DIGHA CALL GIRL 92628/1154 DIGHA CALL GIDIGHA CALL GIRL 92628/1154 DIGHA CALL GI
DIGHA CALL GIRL 92628/1154 DIGHA CALL GI
Ā 
Goa Call Girls šŸ„° +91 9540619990 šŸ“Service Girls In Goa
Goa Call Girls šŸ„° +91 9540619990 šŸ“Service Girls In GoaGoa Call Girls šŸ„° +91 9540619990 šŸ“Service Girls In Goa
Goa Call Girls šŸ„° +91 9540619990 šŸ“Service Girls In Goa
Ā 
9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.
9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.
9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.
Ā 
ENJOY Call Girls In Anand Niketan Delhi Call 8826158885
ENJOY Call Girls In Anand Niketan Delhi Call 8826158885ENJOY Call Girls In Anand Niketan Delhi Call 8826158885
ENJOY Call Girls In Anand Niketan Delhi Call 8826158885
Ā 
Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...
Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...
Call Girls In {Laxmi Nagar Delhi} 9667938988 Indian Russian High Profile Girl...
Ā 
Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...
Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...
Call Girls In {Green Park Delhi} 9667938988 Indian Russian High Profile Girls...
Ā 
NAGPUR CALL GIRL 92628*71154 NAGPUR CALL
NAGPUR CALL GIRL 92628*71154 NAGPUR CALLNAGPUR CALL GIRL 92628*71154 NAGPUR CALL
NAGPUR CALL GIRL 92628*71154 NAGPUR CALL
Ā 
RAJKOT CALL GIRLS 92628/71154 RAJKOT CAL
RAJKOT CALL GIRLS 92628/71154 RAJKOT CALRAJKOT CALL GIRLS 92628/71154 RAJKOT CAL
RAJKOT CALL GIRLS 92628/71154 RAJKOT CAL
Ā 
NASHIK CALL GIRL 92628*71154 NASHIK CALL
NASHIK CALL GIRL 92628*71154 NASHIK CALLNASHIK CALL GIRL 92628*71154 NASHIK CALL
NASHIK CALL GIRL 92628*71154 NASHIK CALL
Ā 
JABALPUR CALL GIRL 92628/71154 JABALPUR K
JABALPUR CALL GIRL 92628/71154 JABALPUR KJABALPUR CALL GIRL 92628/71154 JABALPUR K
JABALPUR CALL GIRL 92628/71154 JABALPUR K
Ā 
100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...
100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...
100% Real Call Girls In Hazrat Nizamuddin Railway Station Delhi | Just Call 9...
Ā 

Php converted pdf

  • 3. ā€œPHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be executed each time the page is visited. Your PHP code is interpreted at the Web server and generates HTML or other output that the visitor will seeā€ (ā€œPHP and MySQL Web Developmentā€, Luke Welling and Laura Thomson, SAMS) Introduction to PHP www.northpolewebservice.com
  • 4. ā— 1994: Created by Rasmis Lesdorf, software engineer (part of Apache Team) ā— 1995: Called Personal Home Page Tool, then released as version 2 with name PHP/FI (Form Interpreter, to analyze SQL queries) ā— Half 1997: used by 50,000 web sites ā— October 1998: used by 100,000 websites ā— End 1999: used by 1,000,000 websites PHP History www.northpolewebservice.com
  • 5. Alternatives to PHP ā— Practical extraction and Report Language (Perl) ā— Active Server Pages (ASP) ā— Java server pages (JSP) ā— Ruby www.northpolewebservice.com
  • 6. How PHP generates HTML/JS Web pages 2 Client Browser 1 PHP module 3 4 Apache 1: Client from browser send HTTP request (with POST/GET variables) 2: Apache recognizes that a PHP script is requested and sends the request to PHP module 3: PHP interpreter executes PHP script, collects script output and sends it back 4: Apache replies to client using the PHP script output as HTML output www.northpolewebservice.com
  • 7. Hello World! (web oriented) <html> <head> <title>My personal Hello World! PHP script</title> </head> <body> <? echo ā€œHello World!ā€; ?> </html> PHP tag, allow to insert PHP code. Interpretation by PHP module will substitute the code with code output www.northpolewebservice.com
  • 8. Example of PHP : ļ‚— <!DOCTYPE html> <html> <body> <?php echo "My first PHP script!"; ?> </body> </html> Output: My first PHP script! www.northpolewebservice.com
  • 9. PHP echo and print statements:- ā€¢echo and print are more or less the same. They are both used to output data to the screen. ā€¢The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print. www.northpolewebservice.com
  • 10. Example of echo statements: ļ‚— <!DOCTYPE html> <html> <body> <?php echo "<h2>PHP is Fun!</h2>"; echo "Hello world!<br>"; echo "I'm about to learn PHP!<br>"; echo "This ", "string ", "was ", "made ", "with multiple parameters."; ?> < >/body </html> ļ‚— Output: PHP is Fun! Hello world! I'm about to learn PHP! This string was made with multiple parameters. www.northpolewebservice.com
  • 11. Example of print statements: ļ‚— <!DOCTYPE html> <html> <body> ?php< print "<h2>PHP is Fun!</h2>"; print "Hello world!<br>"; print "I'm about to learn PHP!"; ?> </body> < >/html ļ‚— Output: PHP is Fun! Hello world! I'm about to learn PHP! www.northpolewebservice.com
  • 12. PHP Operators Operators are used to operate on values. There are four classifications of operators: > Arithmetic > Assignment > Comparison > Logical www.northpolewebservice.com
  • 14. PHP Conditional Statements ā€¢> if statement - use this statement to execute some code only if a specified condition is true ā€¢> if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false ā€¢> if...elseif....else statement - use this statement to select one of several blocks of code to be executed ā€¢> switch statement - use this statement to select one of many blocks of code to be executed www.northpolewebservice.com
  • 15. ā€¢Use the if....else statement to execute some code if a condition is true and another code if a condition is false. www.northpolewebservice.com
  • 16. Arrays (I) ā€¢ Groups a set of variables, every element stored into an array as an associated key (index to retrieve the element) $books = array( 0=>ā€php manualā€,1=>ā€perl manualā€,2=>ā€C manualā€); $books = array( 0=>ā€php manualā€,ā€perl manualā€,ā€C manualā€); $books = array (ā€œphp manualā€,ā€perl manualā€,ā€C manualā€); echo $books[2]; output: C manual ā€¢ Arrays with PHP are associative $books = array( ā€œphp manualā€=>1,ā€perl manualā€=>1,ā€C manualā€=>1); // HASH echo $books[ā€œperl manualā€]; output: 1 $books[ā€œlisp manualā€] = 1; // Add a new element www.northpolewebservice.com
  • 17. Arrays (II) ā€¢ Working on an arrays $books = array( ā€php manualā€,ā€perl manualā€,ā€C manualā€); ā€¢ Common loop for ($i=0; $i < count($books); $i++) print ($i+1).ā€-st book of my library: $books[$i]ā€; ā€¢ each $books = array( ā€œphp manualā€=>1,ā€perl manualā€=>2,ā€C manualā€=>3); while ($item = each( $books )) // Retrieve items one by one print $item[ā€œvalueā€].ā€-st book of my library: ā€.$item[ā€œkeyā€]; // each retrieve an array of two elements with key and value of current element ā€¢ each and list while ( list($value,$key) = each( $books )) print ā€œ$value-st book of my library: $keyā€; // list collect the two element retrieved by each and store them in two different // variables www.northpolewebservice.com
  • 18. Arrays (III) ā€¢ Multidimensional arrays $books = array( array(ā€œtitleā€=>ā€œphp manualā€,ā€editorā€=>ā€Xā€,ā€authorā€=>ā€Aā€), array(ā€œtitleā€=>ā€œperl manualā€,ā€editorā€=>ā€Yā€,ā€authorā€=>ā€Bā€), array(ā€œtitle=>ā€œC manualā€,ā€editorā€=>ā€Zā€,author=>ā€Cā€)); ā€¢ Common loop for ($i=0; $i < count($books); $i++ ) print ā€œ$i-st book, title: ā€.$books[$i][ā€œtitleā€].ā€ author: ā€œ.$books[$i][ā€œauthorā€]. ā€œ editor: ā€œ.$books[$i][ā€œeditorā€]; // Add .ā€nā€ for text new page or ā€œ.<BR>ā€ for HTML new page; ā€¢ Use list and each for ($i=0; $i < count($books); $i++) { print ā€œ$i-st book is: ā€œ; while ( list($key,$value) = each( $books[$i] )) print ā€œ$key: $value ā€; print ā€œ<BR>ā€; // or ā€œnā€ } www.northpolewebservice.com
  • 19. Object Oriented PHP ā€¢ Encapsulation ā€¢ Polymorphism ā€¢ Inheritance ā€¢ Multiple Inheritance: actually unsupported www.northpolewebservice.com
  • 20. Encapsulation <? class dayOfWeek { var $day,$month,$year; function dayOfWeek($day,$month,$year) { $this->day = $day; $this->month = $month; $this->year = $year; } function calculate(){ if ($this->month==1){ $monthTmp=13; $yearTmp = $this->year - 1; } if ($this->month == 2){ $monthTmp = 14; $yearTmp = $this->year - 1; } $val4 = (($month+1)*3)/5; $val5 = $year/4; $val6 = $year/100; $val7 = $year/400; $val8 = $day+($month*2)+$val4+$val3+$val5- $val6+$val7+2; $val9 = $val8/7; $val0 = $val8-($val9*7); return $val0; } } // Main $instance = new dayOfWeek($_GET[ā€œdayā€],$_GET[ā€œweekā€],$ _GET[ā€œ monthā€]); print ā€œYou born on ā€œ.$instance->calculate().ā€nā€; ?> www.northpolewebservice.com
  • 21. Inheritance Allow the creation of a hierarchy of classes Class reuseMe { function reuseMe(){...} function doTask1(){...} function doTask2(){...} function doTask3(){...} } Class extends reuseMe { function example(){ ... // local initializations // call super constructor reuseMe::reuseMe(); } function doTask4(){...} function doTask5(){...} function doTask6(){...} } www.northpolewebservice.com
  • 22. Polymorphism A member function can override superclass implementation. Allow each subclass to reimplement a common interfaces. class reuseMe { function reuseMe(){...} function doTask1(){...} function doTask2(){...} function doTask3(){...} } Class extends reuseMe { function example(){ ... // local initializations // call super constructor reuseMe::reuseMe(); } function doTask4(){...} function doTask5(){...} function doTask6(){...} function doTask3(){...} } www.northpolewebservice.com
  • 23. Multiple Inheritance not actually supported by PHP class reuseMe1 { function reuseMe1(){...} function doTask1(){...} function doTask2(){...} function doTask3(){...} } class reuseMe2 { function reuseMe2(){...} function doTask3(){...} function doTask4(){...} function doTask5(){...} } class extends reuseMe1,reuseMe2 {...} www.northpolewebservice.com
  • 24. Contact us:- To find out more or how we can help you better Address:- C-127 ,2nd Floor, Ozi gym Building , Phase 8, Industrial Area, Mohali, 160055 Phone no:- (+91) 8872155107, 9779127768, 8360890672 Email:- npolewebservice@gmail.com www.northpolewebservice.com