0% found this document useful (0 votes)
79 views29 pages

Ratnesh Kumar

Uploaded by

ratnesk10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views29 pages

Ratnesh Kumar

Uploaded by

ratnesk10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

BY :- RATNESH KUMAR

CONTENTS
• HTML
• JavaScript
• About PHP
• Why PHP
• Structure of PHP Program
• Combining PHP with HTTP
• Features of PHP
• Working of PHP
• PHP Basics
• Real world example of PHP
• Exception Handling
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.
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.
• It’s limited (can not develpe standalone aplli.)
• Widely Used
ABOUT PHP
• PHP (Hypertext Preprocessor),
• Simple and powerful SSSL
• Dynamic web pages.
• It’s 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:
o Named with capital letters.
o Must begin with a letter or underscore .
o Cannot begin with a number.
o Case-sensitive.
Eg: define (“FAVMOVIE”, “The Life of Brian”);
2) VARIABLES:
oPrefixed with a dollar symbol.
oType not to be specified.
oVariable 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”;

3) DATATYPES:
o String
o Integer
o Boolean
o Float
o Object
o 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.
Real World
Example Of PHP

20
OUTLINE
•Summer Training

•PHP architecture at
WHY WE PICKED PHP
1. Designed for web scripting
2. High performance
3. Large, Open Source community
• Documentation, easy to hire
developers
4. “Code-in-HTML” paradigm
<html>
<?php echo "Hello World"; ?>
</html>
5. Integration, libraries, extensibility
6. Tools: IDE, debugger, profiler
Exception
Handling
ERROR TYPES IN PHP
There are 13 predefined error constants that correspond to different types of errors in PHP.

•E_ERROR : Fatal runtime errors that cannot be recovered from; the execution of the script is halted .

•E_WARNING: Nonfatal runtime errors .

•E_PARSE: Compile - time parse errors .

•.

.
CONT…
•E_NOTICE : Nonfatal runtime notices that indicate that
the script encountered something that might be an error,
but could also happen in the normal course of running a
script .
•E_CORE_ERROR: Fatal errors that occur during PHP ’ s
initial startup; the execution of the script is
•halted .

•E_CORE_WARNING : Nonfatal errors that occur during


PHP ’ s initial startup .
CONT…
•E_COMPILE_ERROR : Fatal compile - time errors; the
execution of the script is halted .

•E_COMPILE_WARNING : Nonfatal compile - time errors .

•E_USER_ERROR : User - generated error messages (like


E_ERROR , but instead generated by using by using the
trigger_error() function); the execution of the script is halted .
CONT…

•E_USER_WARNING: User - generated warning messages


(like E_WARNING , but instead generated by using the
trigger_error() function) .

•E_USER_NOTICE : User - generated notice messages (like


E_NOTICE , but instead generated by using the trigger_error()
function) .

•E_STRICT : Runtime notices that suggest changes to your


code that would ensure the best interoperability and forward
compatibility of your code .
CONT…
•E_RECOVERABLE_ERROR: Catchable fatal errors that
indicate that a probably dangerous error occurred, but did
not leave the PHP ’ s execution engine in an unstable state .

•E_ALL : All errors and warnings combined .


Thank You.

You might also like