A Seminar On: Basics of PHP

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

A SEMINAR ON BASICS OF PHP

Presented To: BHOOMIKA PATPATIYA

Presented By: MUKESH KUMAR

Agenda
PHP- Introduction PHP Syntax Variables and Operators PHP arrays PHP Forms

PHP Cookies
Conclusions
08/05/2012 19:02:46 PHP 2

Introduction to PHP
Created in 1995. PHP is server side scripting language. PHP generally understood to mean "PHP: Hypertext Preprocessor". It was originally designed to create dynamic or more interactive web pages.
08/05/2012 19:02:46 PHP 3

Brief History of PHP


PHP (PHP: Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994.
PHP 2 (1995) transformed the language into a Server-side embedded scripting language. Added database support. PHP 3 (1998) added support for ODBC data sources, multiple platform support, email protocols (SNMP,IMAP). PHP 4 (2000) became an independent component of the web server for added efficiency. PHP 5 (2004) adds Zend Engine II with object oriented programming.

08/05/2012 19:02:46

PHP

Benefits of PHP
It is open source so it is free! It can be embedded directly into HTML coding. It can be used on all major operating systems and is supported on most web servers. The latest version of PHP is a very stable. It just need a text editor to work on PHP.

08/05/2012 19:02:46

PHP

PHP Syntax
<?php $message = "Hello, World!"; echo $message; ?>
Every statement is mentioned under the <?...?>. There are two basic statements to output text with PHP: echo and print. Each code line in PHP must end with a semicolon.
08/05/2012 19:02:46 PHP 6

PHP Comments
PHP comments are only visible to developers (unlike HTML comments) Two ways to express comment: Single Line Comment uses // to start a comment echo Not a comment"; // But this is a comment Multiple Line Comment begins with " /* " and ends with " */
08/05/2012 19:02:46 PHP 7

PHP Variables
Variables in PHP are represented by a dollar sign($). PHP supports eight types: Boolean, integer, float, double, array, object, resource and NULL The correct way of declaring a variable in PHP: $var_name = value;

08/05/2012 19:02:46

PHP

PHP Operators
Operators supported by PHP: a) Arithmetic Operators : + , - , * , / , ++ , -b) Assignment Operators : = , += , -= , %= , *= , .= , /= c) Comparison Operators : == , < , > , != ,<= , >= d) Logical Operators : && , ! , | |
08/05/2012 19:02:46 PHP 9

PHP Arrays
An array is a special variable, which can store multiple values in one single variable. In PHP, there are three kind of arrays: a) Numeric array - An array with a numeric index b) Associative array - An array where each ID key is associated with a value c) Multidimensional array - An array containing one or more arrays
08/05/2012 19:02:46 PHP 10

PHP Forms
You can have more than one Form on single web page. Names are not generally important for forms. Values submitted in forms are always string , although once they get into PHP program they may converted to actual data type. Not all form field names and values become available to your PHP program when it get submitted.
08/05/2012 19:02:46 PHP 11

PHP Cookies
A cookie is often used to identify a user. Each time the same computer requests a page with a browser, it will send the cookie.

a)Create Cookies- We use setcookie(name,value,time() method to create cookie.

Syntaxsetcookie(name,value,time()+60); b) Delete Cookie- To delete cookie we set time in Past.


Syntax-

setcookie(name,value,time()-1);

CONCLUSION
PHP is a great tool for writing dynamic web pages. Few things we must remember:
i. PHP is a server-side technology, and does not work in a browser. ii. The filename must have .php extension. iii. PHP enhanced pages can contain a mixture of HTML and PHP code. iv. PHP code must be enclosed in a <?php ?> tag.
08/05/2012 19:02:46 PHP 13

08/05/2012 19:02:46

PHP

14

You might also like