19-07-2014, 11:22 AM
PHP/MySQL Tutorial
PHPMySQL Tutorial.ppt (Size: 201.5 KB / Downloads: 155)
Goal of this tutorial
Not to teach everything about PHP, but provide the basic knowledge
Explain code of examples
Provide some useful references
What is PHP
PHP == ‘Hypertext Preprocessor’
Open-source, server-side scripting language
Used to generate dynamic web-pages
PHP scripts reside between reserved PHP tags
This allows the programmer to embed PHP scripts within HTML pages
What does PHP code look like?
Structurally similar to C/C++
Supports procedural and object-oriented paradigm (to some degree)
All PHP statements end with a semi-colon
Each PHP script must be enclosed in the reserved PHP tag
Variables in PHP
PHP variables must begin with a “$” sign
Case-sensitive ($Foo != $foo != $fOo)
Global and locally-scoped variables
Global variables can be used anywhere
Local variables restricted to a function or class
Certain variable names reserved by PHP
Form variables ($_POST, $_GET)
Server variables ($_SERVER)
Etc.
Echo
The PHP command ‘echo’ is used to output the parameters passed to it
The typical usage for this is to send data to the client’s web-browser
Syntax
void echo (string arg1 [, string argn...])
In practice, arguments are not passed in parentheses since echo is a language construct rather than an actual function
History of PHP
PHP began in 1995 when Rasmus Lerdorf developed a Perl/CGI script toolset he called the Personal Home Page or PHP
PHP 2 released 1997 (PHP now stands for Hypertex Processor). Lerdorf developed it further, using C instead
PHP3 released in 1998 (50,000 users)
PHP4 released in 2000 (3.6 million domains). Considered debut of functional language and including Perl parsing, with other major features
PHP5.0.0 released July 13, 2004 (113 libraries>1,000 functions with extensive object-oriented programming)
PHP5.0.5 released Sept. 6, 2005 for maintenance and bug fixes