what is php? php (recursive acronym for "php: hypertext preprocessor") is a widely-used...

12
What is PHP? 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.

Upload: evangeline-shelton

Post on 29-Dec-2015

241 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

What is PHP?

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.

Page 2: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

What can PHP do?

Server-side Scripting:

This is the most traditional and main target field for PHP. You need three things to make this work:

1. The PHP parser (CGI or server module)

2. A web browser

3. A webserver with a connected PHP installation.

All these can run on your home machine if you are just experimenting with PHP programming.

Page 3: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

What can PHP do?

Command Line Scripting:

You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks.

Page 4: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

What can PHP do?

Desktop Applications:

Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way.

Page 5: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

Database Strength:

Adabas D InterBase PostgreSQL

dBase FrontBase SQLite

Empress mSQL Solid

FilePro (read-only) Direct MS-SQL Sybase

Hyperwave MySQL Velocis

IBM DB2 ODBC Unix dbm

Informix Oracle (OCI7 and OCI8)

Ingres Ovrimos

Page 6: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

Ubiquitous Setups:- Most commonly used with Apache Web Server as module

- Most commonly used with MySQL Database Server

- Most commonly used on the Linux platform

Additional Common Setups:- Growing number of installations on Windows machines

- Local development setups are popular

Page 7: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

19/562,759 Domains, 1,305,799 IP Addresses

Page 8: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

Simple Web Page Example:helloworld.php

<html>   <head>       <title>Example</title>   </head>   <body>

       <?php        echo ‘Hello, world!’;        ?>

   </body></html>

Page 9: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

The GutsVariables:

- variables are given a value at declaration but not a type

$foo = 0;

- always preceded by the dollar sign: $

- vars can be converted to common specific types

(int, variant, etc.)

- typical scope rules apply, but global command may be used

for public or global variables

Page 10: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

The GutsFunctions:

- typically declared in “global” files that are included by all your other website pages -> keep them in one place- optionally with arguments and can return values

<?phpfunction fooFunction($arg1, $arg2 = '') { if (condition) { statement; } return $val;}?>

Page 11: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

The GutsClasses:

- more forgiving than in C++, VB, C# or similar approaches- excellent way to encapsulate and control code

<?phpclass clsFoo { var $my_color = ‘green’;

function clsFoo ($arg1) {

$this->my_color = $arg1; } }?>

Page 12: What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially

Where to Start?- www.php.net

- www.phpmyadmin.net (best free MySQL management tool)

- www.mysql.org (.com)

- www.apache.org (version 1.3.x recommended for a local install)

- www.jtlnet.com (cheap php/mysql hosting – tons out there)

- www.phpbuilder.com (coding resource)

- www.zend.com (Zend Studio 5.x – Visual Studio-type IDE)