SlideShare a Scribd company logo
By: MUHAMMAD ADEEEL
What is PHP ?
The PHP Hypertext Preprocessor
 (PHP -- yes, the first "P" in the acronym does indeed stand for
PHP!)
Allows web developers to create dynamic content that interacts with
databases.
PHP is a widely-used, free, and efficient alternative to competitors such
as Microsoft's ASP.
 PHP is a widely-used, open source scripting language
 PHP scripts are executed on the server
 PHP is free to download and use
 PHP can generate dynamic page content
 PHP can create, open, read, write, delete, and close files on the server
 PHP can collect form data
 PHP can send and receive cookies
 PHP can add, delete, modify data in your database
 PHP can be used to control user-access
 PHP can encrypt data
What is PHP?
 PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
 PHP is compatible with almost all servers used today (Apache, IIS, etc.)
 PHP supports a wide range of databases
 PHP is free. Download it from the official PHP resource: www.php.net
 PHP is easy to learn and runs efficiently on the server side
What is PHP?
HTML CSS JAVASCRIPT JQUERY
You have to Learn Before PHP
 Development started in 1994, by Rasmus Lerdorf.
 PHP originally abbreviation for ‘Personal Home Pages’,
now ‘PHP Hypertext Preprocessor’
 Open Source
 Server-side Scripting(executes on Server.)
 Used to make web application
 HTML-embedded scripting language
 Cross-platform
Main Features of PHP
 Simpler and faster to develop
applications
 Interpreted Language
 Loosely typed language
 PHP is compatible with almost all
servers used today (Apache, IIS, etc.)
 PHP Support Many Databases like
(Mysql ,SQL Server ,Oracle)
 Light-weight
 Cross-platform compatible
 Procedural / Object Oriented programming
 Supports wide range of Databases
 Supports wide variety of outputs
 Open source
Advantages of PHP
 PHP Software
 A Web Server (Apache , IIS)
 An RDBMS (DATABASE Software) (MYSQL)
What We Need For PHP ?
 There Are Different Development Packages available for PHP.
(Package:-collection Of Software's.)
These Are Some Development Packages:-
• XAMPP Server
• WAMP Server
• LAMP Server
• MAMP Server
• SAMP Server
How to Install PHP ?
 For XAMPP Apache visit:
https://www.apachefriends.org/download.html
How to Install Web Servers
 XAMPP (X Cross Platform)
 Provide APACHE , MYSQL , PHP , PERAL
 WAMP (W Windows)
 Provide APACHE , MYSQL , PHP
 LAMP (L LINUX)
 MAMP (M Macintosh)
 SAMP (S Sun Solaris)
Web Development Packages
• written in the C programming language
• Rasmus Lerdorf in 1994
• for use in monitoring his online resume and related personal
information.
• For this reason, PHP originally stood for
• "Personal Home Page"
• Because php libraries are already compiled and processed.
• Person request any php page in browser address bar that
request first go to server for example Apache is running on that
server.
• Server interpret php files and return back response in form of
HTML
 Most software we use have been compiled. This means that its computer code has been
put through an application that translates it into a form your computer can understand.
After a program has been compiled, it's nearly impossible to modify it or see exactly how
it was created.
 Open source software includes the source code along with the compiled code. People
who write open source software actually encourage others to customize it
 Cross-platform software can run on most or all systems with little or no modification
 Not limited to output HTML.
 Abilities includes outputting images
 PDF files and
 even Flash movies
 You can also output easily any text, such as XHTML and any other
XML file.
OUTPUT
Basic Syntax
<?php
// PHP code goes here
?>
Basic Syntax
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>
In PHP, a variable starts with the $ sign,
followed by the name of the variable.
PHP has three different variable scopes:
 local
 global
 Static
PHP Variables
<!DOCTYPE html>
<html>
<body>
<?php
$txt = "W3Schools.com";
echo "I love " . $txt . "!";
?>
</body>
</html>
 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.
PHP echo & Print Statements
<?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.";
?>
PHP supports the following data types:
 String
 Integer
 Float (floating point numbers - also called double)
 Boolean
 Array
 Object
 NULL
 Resource
PHP Data Types
Operators are used to perform operations on variables and values.
PHP divides the operators in the following groups:
 Arithmetic operators
 Assignment operators
 Comparison operators
 Increment/Decrement operators
 Logical operators
 String operators
 Array operators
PHP Operators
 A function name can start with
a letter or underscore (not a
number).
PHP Functions
<?php
function familyName($fname) {
echo "$fname Refsnes.<br>";
}
familyName("Jani");
familyName("Hege");
familyName("Stale");
familyName("Kai Jim");
familyName("Borge");
?>
 The PHP superglobals $_GET and $_POST are used to collect
form-data.
PHP Form Handling
<html>
<body>
Welcome <?php echo $_GET["name"]; ?><br>
Your email address is: <?php echo
$_GET["email"]; ?>
</body>
</html>
<html>
<body>
Welcome <?php echo $_POST["name"];
?><br>
Your email address is: <?php echo
$_POST["email"]; ?>
</body>
</html>
 Both GET and POST create an array
 $_GET is an array of variables passed to the current script via the URL
parameters.
 $_POST is an array of variables passed to the current script via the HTTP
POST method.
 Information sent from a form with the GET method is visible to everyone.
 Information sent from a form with the POST method is invisible to others.
GET VS POST
 to open files is with the fopen() function.
 The fread() function reads from an open
file.
 The fclose() function is used to close an
open file.
 The fgets() function is used to read a single
line from a file.
 The feof() function checks if the "end-of-
file" (EOF) has been reached.
 The fgetc() function is used to read a single
character from a file.
PHP File Open/Read/Close
<?php
$myfile =
fopen("webdictionary.txt",
"r");
// some code to be
executed....
fclose($myfile);
?>
 The fopen() function is also used to create a file.
 The fwrite() function is used to write to a file.
 The first parameter of fwrite() contains the name of the file to
write to and the second parameter is the string to be written.
PHP File Create/Write
Several predefined variables in PHP are "superglobals", which means that they are always accessible,
regardless of scope - and you can access them from any function, class or file without having to do
anything special.
The PHP superglobal variables are:
 $GLOBALS
 $_SERVER
 $_REQUEST
 $_POST
 $_GET
 $_FILES
 $_ENV
 $_COOKIE
 $_SESSION
PHP Superglobal
 A cookie is often used to identify a user. A
cookie is a small file that the server
embeds on the user's computer. Each
time the same computer requests a page
with a browser, it will send the cookie too.
With PHP, you can both create and
retrieve cookie values.
 A cookie is created with the setcookie()
function.
PHP Cookie
<?php
$cookie_name = "user";
$cookie_value = "John Doe";
setcookie($cookie_name,
$cookie_value, time() +
(86400 * 30),"/"); // 86400 = 1 day
?>
<html>
<body>
<?php
if(!isset($_COOKIE[$cookie_name])) {
echo "Cookie named '" .
$cookie_name . "' is not set!";
} else {
echo "Cookie '" . $cookie_name
. "' is set!<br>";
echo "Value is:
" . $_COOKIE[$cookie_name];
}
?>
</body>
</html>
 A session is a way to store
information (in variables) to be
used across multiple pages
 A session is started with the
session_start() function.
 Session variables are set with the
PHP global variable: $_SESSION.
PHP Sessions
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
?>
</body>
</html>
 PHP 5 and later can work with a MySQL database using:
 MySQLi extension (the "i" stands for improved)
 PDO (PHP Data Objects)
 PDO will work on 12 different database systems, where as
MySQLi will only work with MySQL databases.
How to Connect PHP with MySQL Database.
 For MySQLi Installation go
to: http://php.net/manual/en/mysqli.installation.php
 For PDO Installation go to:
http://php.net/manual/en/pdo.installation.php
How to Connect PHP with MySQL Database
(cont.)
Connect with MySQLi
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
Connect with PDO
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
Thank You…..

More Related Content

What's hot

Php File Upload
Php File UploadPhp File Upload
Php File Upload
Hiroaki Kawai
 
File upload php
File upload phpFile upload php
File upload php
sana mateen
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
Mandakini Kumari
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...webhostingguy
 
A History of PHP
A History of PHPA History of PHP
A History of PHP
Xinchen Hui
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
Annujj Agrawaal
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Collaboration Technologies
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
JIGAR MAKHIJA
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
Mohammad Tahsin Alshalabi
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
Milad Rahimi
 
What Is Php
What Is PhpWhat Is Php
What Is Php
AVC
 
Php workshop L04 database
Php workshop L04 databasePhp workshop L04 database
Php workshop L04 database
Mohammad Tahsin Alshalabi
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
Alan Pinstein
 
PHP Function
PHP Function PHP Function
PHP Function
Reber Novanta
 

What's hot (19)

File Upload
File UploadFile Upload
File Upload
 
Php File Upload
Php File UploadPhp File Upload
Php File Upload
 
Introduction to php web programming - get and post
Introduction to php  web programming - get and postIntroduction to php  web programming - get and post
Introduction to php web programming - get and post
 
File upload php
File upload phpFile upload php
File upload php
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
 
A History of PHP
A History of PHPA History of PHP
A History of PHP
 
File Uploading in PHP
File Uploading in PHPFile Uploading in PHP
File Uploading in PHP
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
 
What Is Php
What Is PhpWhat Is Php
What Is Php
 
Php workshop L04 database
Php workshop L04 databasePhp workshop L04 database
Php workshop L04 database
 
Php presentation
Php presentationPhp presentation
Php presentation
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
PHP Function
PHP Function PHP Function
PHP Function
 

Viewers also liked

Parecer jurídico normativo 36 2011 CFESS
Parecer jurídico normativo 36 2011 CFESSParecer jurídico normativo 36 2011 CFESS
Parecer jurídico normativo 36 2011 CFESS
FILIPE NERI
 
生日快乐
生日快乐生日快乐
生日快乐
Paul Ni
 
Get AMP’ed for AMP!
Get AMP’ed for AMP!Get AMP’ed for AMP!
Get AMP’ed for AMP!
Greenlane
 
Glossary
GlossaryGlossary
Glossary
candyclouds
 
Investing 101: How to Prepare for Retirement
Investing 101: How to Prepare for RetirementInvesting 101: How to Prepare for Retirement
Investing 101: How to Prepare for Retirement
Experian_US
 
横手版地方発信のソーシャルメディア
横手版地方発信のソーシャルメディア横手版地方発信のソーシャルメディア
横手版地方発信のソーシャルメディアSkunkWork.Co.,Ltd
 
ноябрь
ноябрьноябрь
ноябрь
lesik1990
 
Brecha tecnológica y discapacidad.
Brecha tecnológica y discapacidad.Brecha tecnológica y discapacidad.
Brecha tecnológica y discapacidad.
José María
 
Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6
Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6
Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6
Tiziano Menconi
 
Comic analysis powerpoint
Comic analysis powerpointComic analysis powerpoint
Comic analysis powerpoint
Westminster MassComm
 
Mapping Voyager 1's 36-Year Trek Through Space
Mapping Voyager 1's 36-Year Trek Through SpaceMapping Voyager 1's 36-Year Trek Through Space
Mapping Voyager 1's 36-Year Trek Through Space
Mashable
 
The Link Between Processed Meat and Cancer Risk
The Link Between Processed Meat and Cancer RiskThe Link Between Processed Meat and Cancer Risk
The Link Between Processed Meat and Cancer Risk
Dana-Farber Cancer Institute
 
SuprTEK Continuous Monitoring
SuprTEK Continuous MonitoringSuprTEK Continuous Monitoring
SuprTEK Continuous Monitoring
Tieu Luu
 
Delivering Vertical Social Apps - Dreamforce - 9/18
Delivering Vertical Social Apps - Dreamforce - 9/18Delivering Vertical Social Apps - Dreamforce - 9/18
Delivering Vertical Social Apps - Dreamforce - 9/18
Salesforce Partners
 
3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...
3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...
3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...SlideTeam.net
 

Viewers also liked (17)

Parecer jurídico normativo 36 2011 CFESS
Parecer jurídico normativo 36 2011 CFESSParecer jurídico normativo 36 2011 CFESS
Parecer jurídico normativo 36 2011 CFESS
 
生日快乐
生日快乐生日快乐
生日快乐
 
Get AMP’ed for AMP!
Get AMP’ed for AMP!Get AMP’ed for AMP!
Get AMP’ed for AMP!
 
Glossary
GlossaryGlossary
Glossary
 
ตารางแนวทางกำหนดการจัดเวทีฯ
ตารางแนวทางกำหนดการจัดเวทีฯตารางแนวทางกำหนดการจัดเวทีฯ
ตารางแนวทางกำหนดการจัดเวทีฯ
 
Investing 101: How to Prepare for Retirement
Investing 101: How to Prepare for RetirementInvesting 101: How to Prepare for Retirement
Investing 101: How to Prepare for Retirement
 
横手版地方発信のソーシャルメディア
横手版地方発信のソーシャルメディア横手版地方発信のソーシャルメディア
横手版地方発信のソーシャルメディア
 
ноябрь
ноябрьноябрь
ноябрь
 
Brecha tecnológica y discapacidad.
Brecha tecnológica y discapacidad.Brecha tecnológica y discapacidad.
Brecha tecnológica y discapacidad.
 
Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6
Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6
Import Guide - Cloud for Customer Edge and Starter Edition - Guide v2.6
 
Logo
LogoLogo
Logo
 
Comic analysis powerpoint
Comic analysis powerpointComic analysis powerpoint
Comic analysis powerpoint
 
Mapping Voyager 1's 36-Year Trek Through Space
Mapping Voyager 1's 36-Year Trek Through SpaceMapping Voyager 1's 36-Year Trek Through Space
Mapping Voyager 1's 36-Year Trek Through Space
 
The Link Between Processed Meat and Cancer Risk
The Link Between Processed Meat and Cancer RiskThe Link Between Processed Meat and Cancer Risk
The Link Between Processed Meat and Cancer Risk
 
SuprTEK Continuous Monitoring
SuprTEK Continuous MonitoringSuprTEK Continuous Monitoring
SuprTEK Continuous Monitoring
 
Delivering Vertical Social Apps - Dreamforce - 9/18
Delivering Vertical Social Apps - Dreamforce - 9/18Delivering Vertical Social Apps - Dreamforce - 9/18
Delivering Vertical Social Apps - Dreamforce - 9/18
 
3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...
3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...
3 d pie chart circular puzzle with hole in center process stages 11 style 3 p...
 

Similar to PHP Hypertext Preprocessor

PHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERSPHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
Php intro
Php introPhp intro
Php intro
Jennie Gajjar
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
SHARANBAJWA
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
Sleepy Head
 
WT_PHP_PART1.pdf
WT_PHP_PART1.pdfWT_PHP_PART1.pdf
WT_PHP_PART1.pdf
HambardeAtharva
 
basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)
Guni Sonow
 
PHP
PHPPHP
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
Rajamanickam Gomathijayam
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
UmeshSingh159
 
Php
PhpPhp
Basics PHP
Basics PHPBasics PHP
Php Tutorial
Php TutorialPhp Tutorial
Php
PhpPhp
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting language
Elmer Concepcion Jr.
 
Day1
Day1Day1
Day1
IRWAA LLC
 
Basic php 5
Basic php 5Basic php 5
Basic php 5
Engr. Raud Ahmed
 

Similar to PHP Hypertext Preprocessor (20)

PHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERSPHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERS
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
 
WT_PHP_PART1.pdf
WT_PHP_PART1.pdfWT_PHP_PART1.pdf
WT_PHP_PART1.pdf
 
basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)
 
PHP
PHPPHP
PHP
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
 
Php
PhpPhp
Php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php
PhpPhp
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 basics
php basicsphp basics
php basics
 
Php basics
Php basicsPhp basics
Php basics
 
Day1
Day1Day1
Day1
 
Basic php 5
Basic php 5Basic php 5
Basic php 5
 

More from adeel990

Artificial intelligence and Fuzzy Logic
Artificial intelligence and Fuzzy Logic Artificial intelligence and Fuzzy Logic
Artificial intelligence and Fuzzy Logic
adeel990
 
CRM - Customer Relationship Managemennt
CRM - Customer Relationship Managemennt CRM - Customer Relationship Managemennt
CRM - Customer Relationship Managemennt
adeel990
 
Pakistan Rich in Natural Resources But Poor Management
Pakistan Rich in Natural Resources But Poor Management Pakistan Rich in Natural Resources But Poor Management
Pakistan Rich in Natural Resources But Poor Management
adeel990
 
Apple - Steve Jobs
Apple - Steve Jobs Apple - Steve Jobs
Apple - Steve Jobs
adeel990
 
Np completeness-Design and Analysis of Algorithms
Np completeness-Design and Analysis of Algorithms Np completeness-Design and Analysis of Algorithms
Np completeness-Design and Analysis of Algorithms
adeel990
 
Civil liberties and Child Labour
Civil liberties and Child Labour Civil liberties and Child Labour
Civil liberties and Child Labour
adeel990
 
Illuminati, rothschild family
Illuminati, rothschild familyIlluminati, rothschild family
Illuminati, rothschild family
adeel990
 
Objectification of women in advertisments
Objectification of women in advertismentsObjectification of women in advertisments
Objectification of women in advertisments
adeel990
 
jQuery - Web Engineering
jQuery - Web Engineering jQuery - Web Engineering
jQuery - Web Engineering
adeel990
 

More from adeel990 (9)

Artificial intelligence and Fuzzy Logic
Artificial intelligence and Fuzzy Logic Artificial intelligence and Fuzzy Logic
Artificial intelligence and Fuzzy Logic
 
CRM - Customer Relationship Managemennt
CRM - Customer Relationship Managemennt CRM - Customer Relationship Managemennt
CRM - Customer Relationship Managemennt
 
Pakistan Rich in Natural Resources But Poor Management
Pakistan Rich in Natural Resources But Poor Management Pakistan Rich in Natural Resources But Poor Management
Pakistan Rich in Natural Resources But Poor Management
 
Apple - Steve Jobs
Apple - Steve Jobs Apple - Steve Jobs
Apple - Steve Jobs
 
Np completeness-Design and Analysis of Algorithms
Np completeness-Design and Analysis of Algorithms Np completeness-Design and Analysis of Algorithms
Np completeness-Design and Analysis of Algorithms
 
Civil liberties and Child Labour
Civil liberties and Child Labour Civil liberties and Child Labour
Civil liberties and Child Labour
 
Illuminati, rothschild family
Illuminati, rothschild familyIlluminati, rothschild family
Illuminati, rothschild family
 
Objectification of women in advertisments
Objectification of women in advertismentsObjectification of women in advertisments
Objectification of women in advertisments
 
jQuery - Web Engineering
jQuery - Web Engineering jQuery - Web Engineering
jQuery - Web Engineering
 

Recently uploaded

Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
muralinath2
 
Lab report on liquid viscosity of glycerin
Lab report on liquid viscosity of glycerinLab report on liquid viscosity of glycerin
Lab report on liquid viscosity of glycerin
ossaicprecious19
 
Seminar of U.V. Spectroscopy by SAMIR PANDA
 Seminar of U.V. Spectroscopy by SAMIR PANDA Seminar of U.V. Spectroscopy by SAMIR PANDA
Seminar of U.V. Spectroscopy by SAMIR PANDA
SAMIR PANDA
 
Richard's entangled aventures in wonderland
Richard's entangled aventures in wonderlandRichard's entangled aventures in wonderland
Richard's entangled aventures in wonderland
Richard Gill
 
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...
University of Maribor
 
insect taxonomy importance systematics and classification
insect taxonomy importance systematics and classificationinsect taxonomy importance systematics and classification
insect taxonomy importance systematics and classification
anitaento25
 
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATIONPRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
ChetanK57
 
EY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptxEY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptx
AlguinaldoKong
 
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
ssuserbfdca9
 
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Sérgio Sacani
 
Leaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdfLeaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdf
RenuJangid3
 
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
Scintica Instrumentation
 
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCINGRNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
AADYARAJPANDEY1
 
Body fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptx
Body fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptxBody fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptx
Body fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptx
muralinath2
 
Hemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptxHemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptx
muralinath2
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
pablovgd
 
Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...
Sérgio Sacani
 
ESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptxESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptx
muralinath2
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
silvermistyshot
 
Citrus Greening Disease and its Management
Citrus Greening Disease and its ManagementCitrus Greening Disease and its Management
Citrus Greening Disease and its Management
subedisuryaofficial
 

Recently uploaded (20)

Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
 
Lab report on liquid viscosity of glycerin
Lab report on liquid viscosity of glycerinLab report on liquid viscosity of glycerin
Lab report on liquid viscosity of glycerin
 
Seminar of U.V. Spectroscopy by SAMIR PANDA
 Seminar of U.V. Spectroscopy by SAMIR PANDA Seminar of U.V. Spectroscopy by SAMIR PANDA
Seminar of U.V. Spectroscopy by SAMIR PANDA
 
Richard's entangled aventures in wonderland
Richard's entangled aventures in wonderlandRichard's entangled aventures in wonderland
Richard's entangled aventures in wonderland
 
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...
 
insect taxonomy importance systematics and classification
insect taxonomy importance systematics and classificationinsect taxonomy importance systematics and classification
insect taxonomy importance systematics and classification
 
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATIONPRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
 
EY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptxEY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptx
 
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
 
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
 
Leaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdfLeaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdf
 
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
 
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCINGRNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
 
Body fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptx
Body fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptxBody fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptx
Body fluids_tonicity_dehydration_hypovolemia_hypervolemia.pptx
 
Hemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptxHemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptx
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
 
Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...
 
ESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptxESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptx
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
 
Citrus Greening Disease and its Management
Citrus Greening Disease and its ManagementCitrus Greening Disease and its Management
Citrus Greening Disease and its Management
 

PHP Hypertext Preprocessor

  • 2. What is PHP ? The PHP Hypertext Preprocessor  (PHP -- yes, the first "P" in the acronym does indeed stand for PHP!) Allows web developers to create dynamic content that interacts with databases. PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
  • 3.  PHP is a widely-used, open source scripting language  PHP scripts are executed on the server  PHP is free to download and use  PHP can generate dynamic page content  PHP can create, open, read, write, delete, and close files on the server  PHP can collect form data  PHP can send and receive cookies  PHP can add, delete, modify data in your database  PHP can be used to control user-access  PHP can encrypt data What is PHP?
  • 4.  PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)  PHP is compatible with almost all servers used today (Apache, IIS, etc.)  PHP supports a wide range of databases  PHP is free. Download it from the official PHP resource: www.php.net  PHP is easy to learn and runs efficiently on the server side What is PHP?
  • 5. HTML CSS JAVASCRIPT JQUERY You have to Learn Before PHP
  • 6.  Development started in 1994, by Rasmus Lerdorf.  PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Preprocessor’  Open Source  Server-side Scripting(executes on Server.)  Used to make web application  HTML-embedded scripting language  Cross-platform Main Features of PHP  Simpler and faster to develop applications  Interpreted Language  Loosely typed language  PHP is compatible with almost all servers used today (Apache, IIS, etc.)  PHP Support Many Databases like (Mysql ,SQL Server ,Oracle)
  • 7.  Light-weight  Cross-platform compatible  Procedural / Object Oriented programming  Supports wide range of Databases  Supports wide variety of outputs  Open source Advantages of PHP
  • 8.  PHP Software  A Web Server (Apache , IIS)  An RDBMS (DATABASE Software) (MYSQL) What We Need For PHP ?
  • 9.  There Are Different Development Packages available for PHP. (Package:-collection Of Software's.) These Are Some Development Packages:- • XAMPP Server • WAMP Server • LAMP Server • MAMP Server • SAMP Server How to Install PHP ?
  • 10.  For XAMPP Apache visit: https://www.apachefriends.org/download.html How to Install Web Servers
  • 11.  XAMPP (X Cross Platform)  Provide APACHE , MYSQL , PHP , PERAL  WAMP (W Windows)  Provide APACHE , MYSQL , PHP  LAMP (L LINUX)  MAMP (M Macintosh)  SAMP (S Sun Solaris) Web Development Packages
  • 12. • written in the C programming language • Rasmus Lerdorf in 1994 • for use in monitoring his online resume and related personal information. • For this reason, PHP originally stood for • "Personal Home Page" • Because php libraries are already compiled and processed. • Person request any php page in browser address bar that request first go to server for example Apache is running on that server. • Server interpret php files and return back response in form of HTML
  • 13.  Most software we use have been compiled. This means that its computer code has been put through an application that translates it into a form your computer can understand. After a program has been compiled, it's nearly impossible to modify it or see exactly how it was created.  Open source software includes the source code along with the compiled code. People who write open source software actually encourage others to customize it  Cross-platform software can run on most or all systems with little or no modification
  • 14.  Not limited to output HTML.  Abilities includes outputting images  PDF files and  even Flash movies  You can also output easily any text, such as XHTML and any other XML file. OUTPUT
  • 15. Basic Syntax <?php // PHP code goes here ?>
  • 16. Basic Syntax <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo "Hello World!"; ?> </body> </html>
  • 17. In PHP, a variable starts with the $ sign, followed by the name of the variable. PHP has three different variable scopes:  local  global  Static PHP Variables <!DOCTYPE html> <html> <body> <?php $txt = "W3Schools.com"; echo "I love " . $txt . "!"; ?> </body> </html>
  • 18.  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. PHP echo & Print Statements <?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."; ?>
  • 19. PHP supports the following data types:  String  Integer  Float (floating point numbers - also called double)  Boolean  Array  Object  NULL  Resource PHP Data Types
  • 20. Operators are used to perform operations on variables and values. PHP divides the operators in the following groups:  Arithmetic operators  Assignment operators  Comparison operators  Increment/Decrement operators  Logical operators  String operators  Array operators PHP Operators
  • 21.
  • 22.  A function name can start with a letter or underscore (not a number). PHP Functions <?php function familyName($fname) { echo "$fname Refsnes.<br>"; } familyName("Jani"); familyName("Hege"); familyName("Stale"); familyName("Kai Jim"); familyName("Borge"); ?>
  • 23.  The PHP superglobals $_GET and $_POST are used to collect form-data. PHP Form Handling <html> <body> Welcome <?php echo $_GET["name"]; ?><br> Your email address is: <?php echo $_GET["email"]; ?> </body> </html> <html> <body> Welcome <?php echo $_POST["name"]; ?><br> Your email address is: <?php echo $_POST["email"]; ?> </body> </html>
  • 24.  Both GET and POST create an array  $_GET is an array of variables passed to the current script via the URL parameters.  $_POST is an array of variables passed to the current script via the HTTP POST method.  Information sent from a form with the GET method is visible to everyone.  Information sent from a form with the POST method is invisible to others. GET VS POST
  • 25.  to open files is with the fopen() function.  The fread() function reads from an open file.  The fclose() function is used to close an open file.  The fgets() function is used to read a single line from a file.  The feof() function checks if the "end-of- file" (EOF) has been reached.  The fgetc() function is used to read a single character from a file. PHP File Open/Read/Close <?php $myfile = fopen("webdictionary.txt", "r"); // some code to be executed.... fclose($myfile); ?>
  • 26.  The fopen() function is also used to create a file.  The fwrite() function is used to write to a file.  The first parameter of fwrite() contains the name of the file to write to and the second parameter is the string to be written. PHP File Create/Write
  • 27. Several predefined variables in PHP are "superglobals", which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything special. The PHP superglobal variables are:  $GLOBALS  $_SERVER  $_REQUEST  $_POST  $_GET  $_FILES  $_ENV  $_COOKIE  $_SESSION PHP Superglobal
  • 28.  A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.  A cookie is created with the setcookie() function. PHP Cookie <?php $cookie_name = "user"; $cookie_value = "John Doe"; setcookie($cookie_name, $cookie_value, time() + (86400 * 30),"/"); // 86400 = 1 day ?> <html> <body> <?php if(!isset($_COOKIE[$cookie_name])) { echo "Cookie named '" . $cookie_name . "' is not set!"; } else { echo "Cookie '" . $cookie_name . "' is set!<br>"; echo "Value is: " . $_COOKIE[$cookie_name]; } ?> </body> </html>
  • 29.  A session is a way to store information (in variables) to be used across multiple pages  A session is started with the session_start() function.  Session variables are set with the PHP global variable: $_SESSION. PHP Sessions <?php // Start the session session_start(); ?> <!DOCTYPE html> <html> <body> <?php // Set session variables $_SESSION["favcolor"] = "green"; $_SESSION["favanimal"] = "cat"; echo "Session variables are set."; ?> </body> </html>
  • 30.  PHP 5 and later can work with a MySQL database using:  MySQLi extension (the "i" stands for improved)  PDO (PHP Data Objects)  PDO will work on 12 different database systems, where as MySQLi will only work with MySQL databases. How to Connect PHP with MySQL Database.
  • 31.  For MySQLi Installation go to: http://php.net/manual/en/mysqli.installation.php  For PDO Installation go to: http://php.net/manual/en/pdo.installation.php How to Connect PHP with MySQL Database (cont.)
  • 32. Connect with MySQLi <?php $servername = "localhost"; $username = "username"; $password = "password"; // Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; ?>
  • 33. Connect with PDO <?php $servername = "localhost"; $username = "username"; $password = "password"; // Create connection $conn = mysqli_connect($servername, $username, $password); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?>