Você está na página 1de 23

PHP

Contents

HTML
JavaScript
PHP
MySQL
WAMP

HTML

Hyper Text Markup Language


Developed by Tim Berners lee in 1990.
An extended version of SGML.
Easy to use ,Easy to learn
Markup tags tell the browser how to display
the page.
A HTML file must have an extension .htm
or.html.

Cont..
HTML tags are surrounded by < and >
(angular brackets).
Tags normally come in pairs like <H1> and
</H1>.
Tags are not case sensitive i.e. <p> is same
as <P>.
The first tag in a pair is the start tag, the
second tag is the end tag.
Empty tags & non-empty tags.

Cont

JavaScript

JavaScript Java
Developed by Netscape
Purpose: to Create Dynamic websites
Starts with < script type=text/java script>
and ends with < /script>.
Easy to learn , easy to use.
More powerful,loosely typed

Cont

Conversion automatically
Used to customize web pages.
Make pages more dynamic.
To validate CGI forms.
Its limited (can not develpe standalone
aplli.)
Widely Used

About PHP

PHP (Hypertext Preprocessor),


Simple and powerful SSSL
Dynamic web pages.
Its like ASP.
PHP scripts are executed on the server .
PHP files have a file extension of ".php",
".php3", or ".phtml".

History of PHP
PHP , Rasmus lerdorf in 1995
PHP/FI (PHP 2) (Personal Home Page/
Forms Interpreter),1997.
PHP 3,(PHP :Hyphertext Preprocessor)
Andi Gutmans and Zeev Suraski,
API,1998
PHP 4, 2000,compile first, execute
lator(Zend engine)
PHP 5, 2004 (object oriented features).

Why PHP
PHP runs on different platforms (Windows,
Linux, Unix, etc.)
PHP is compatible with almost all servers
used today (Apache, IIS, etc.)
PHP is FREE to download from the official
PHP resource: www.php.net
PHP is easy to learn and runs efficiently on
the server side

Cont
A PHP scripting block always starts with
<?php and ends with ?>.
Can be placed any where within a
document.
We can start a scripting block with <? and
end with ?> on servers that provide
shorthand support.
It is advised to use standard tags for best
outputs.

Structure of PHP Programe


<html>
<body>
<?php
echo hi friends..";
?>
</body>
</html>

Combining PHP with HTml


<html>
<head>
<title>My First Web Page</title>
</head>
<body bgcolor="white">
<p>A Paragraph of Text</p>
<?php
Echo HELLO;
?>
</body>
</html>

What can PHP do


Server-side scripting (collect form data,
generate dynamic page content,
send&receive cookies).
Command line script (can run from cmd
line & used for backup & logparsing).
Create a desktop application with a
graphical user interface (PHP-GTK, an
extension of PHP).

Features of PHP
Speed
Full database Support
Open source and free to download and
use.
Cross platform
Easy for newcomer and advance features

Cont
Used to create dynamic web pages.
Freedom to choose any operating system
and a web server.
Not constrained to output only HTML. PHP's
abilities include outputting images, PDF files
etc.
Support for a wide range of databases. Eg:
dBase, MySQL, Oracle etc.
Support for talking to other services using
protocols such as IMAP, POP3, HTTP.
PHP includes free and open source libraries
with the core build.

Working of PHP

URL is typed in the browser.


The browser sends a request to the web server.
The web server then calls the PHP script on that
page.
The PHP module executes the script, which then
sends out the result in the form of HTML back to
the browser, which can be seen on the screen.

PHP BASICS
SYNTAX:
<?php
s1; s2; ?>
PHP only parses code within its delimiters.

PHP Basics includes:


1) CONSTANTS:
Named with capital letters.
Must begin with a letter or underscore .
Cannot begin with a number.
Case-sensitive.
Eg: define (FAVMOVIE, The Life of Brian);
o
o
o
o

2) VARIABLES:
Prefixed with a dollar symbol.
Type not to be specified.
Variable name should not have spaces, dot or dashes but
underscore can be there.
o They need to be declared before adding a value to it.
Example: $s = SR;
o
o
o

3) DATATYPES:
o
o
o
o
o
o

String
Integer
Boolean
Float
Object
Resources

4) OPERATORS and OPERANDS:


Operands are the entities that have some values in them. The
operators are used to compare the two conditions .

5) COMMENTS:
// A comment on a single line
# Another single line comment
/* Multi-line comment */

6) DISPLAY STATEMENTS:
<?php echo "I like About" ?>
<?php print "I like About" ?>

7) ARRAYS:
It holds a string of related data.

8) CONDITIONAL STATEMENTS:
It allows our program to make choices.

9) LOOPS:
When we want the same block of code to run over & over again in
a sequence.
while - loops through a block of code while the condition is
true.
do...while - loops through a block of code once, and then
repeats the loop as long as a specified condition is true.
for - loops through a block of code a specified number of
times.
foreach - loops through a block of code for each element in
an array

10) FUNCTIONS:
A function is something that performs a specific task.

Continue in Slide - 2

Você também pode gostar