Title | Lecture notes, Introduction to PHP Programming |
---|---|
Course | Web I: Client Development (formerly COMP 1511) |
Institution | Mount Royal University |
Pages | 27 |
File Size | 508.6 KB |
File Type | |
Total Downloads | 113 |
Total Views | 160 |
Download Lecture notes, Introduction to PHP Programming PDF
Introduction to PHP Programming
What is PHP? ●
●
●
PHP: Hypertext Processor Server-side scripting language Interpreted
My First PHP Script
Running the Script $ php -f helloworld.php Hello World! $
Understanding CGI Web Server
GET helloworld.php
Understanding CGI Web Server
Web Server
Fork
Understanding CGI Web Server
PHP Interpreter
Exec
Understanding CGI Request Parameters
Web Server
PHP Interpreter Generated HTML Document
Pass Data
Understanding CGI Web Server
Generated HTML sent to client
Another Way
The Other Result $ php -f helloworldweb2.php
Another Way to Do It
Hello World!
Integrating with HTML
My First Integrated Script
Result of Integrating $ php -f helloworldweb.php
My First Integrated Script
PHP Variables
Properties of Variables ●
Loosely Typed
●
Reusable
●
Two forms: –
Assign by value
–
Assign by reference
Naming Variables
$[A-Za-z_][A-Za-z0-9_]*
Types of Variables ●
●
Scalar –
Boolean
–
Integer
–
Float
–
String
Compound –
Array
–
Object
Predefined Variables ●
●
●
Variables that are available to all scripts Examples –
argc
–
argv
Superglobals –
$_GET
–
$_POST $GLOBALS
–
Boolean: What is FALSE? ●
FALSE
●
integer 0
●
Float 0.0
●
●
●
the empty string and the string "0" an array with zero elements NULL (including unset variables)
Integers ●
$a = 1234;
●
$a = -123;
●
$a = 0123;
●
$a = 0x1A;
Strings ●
'My string'
●
“My string\n”
●
$str =...