php basic fundamentals - a quick review

23
PHP

Upload: apex-tgi

Post on 14-Nov-2015

21 views

Category:

Documents


5 download

DESCRIPTION

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

TRANSCRIPT

  • 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 (angular brackets).

    Tags normally come in pairs like and .

    Tags are not case sensitive i.e. is same as .

    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 .

    Can be placed any where within a document.

    We can start a scripting block with on servers that provide shorthand support.

    It is advised to use standard tags for best outputs.

  • Structure of PHP Programe

  • Combining PHP with HTml

    My First Web Page

    A Paragraph of Text

  • 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, anextension 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.

  • 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.

    Working of PHP

  • SYNTAX:

    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);

    PHP BASICS

  • 2) VARIABLES:o Prefixed with a dollar symbol.o Type not to be specified.o 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;

    3) DATATYPES:o Stringo Integero Booleano Floato Objecto 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:

    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

  • PHPContentsHTMLCont..ContJavaScriptSlide 7About PHPHistory of PHPWhy PHPSlide 11Structure of PHP ProgrameCombining PHP with HTmlWhat can PHP doFeatures of PHPSlide 16Working of PHPPHP BASICSSlide 19Slide 20Slide 21Slide 22Slide 23