used for building websites. • Developed by Rasmus Lerdorf in 1994. • Collection of small computer programs / scripts that he used to build websites. • PHP/FI - Personal Home Page / Forms Interpreter
Suraski helped to turn it into a real programming language (PHP 3.0) • PHP: Hypertext Preprocessor • PHP 3 Released in June 1998 • One of the most commonly used programming language used for building dynamic websites.
a web server. • Web server is a software connected to a computer network (Internet or LAN), that is meant to share hypertext documents (HTML). • Nowadays u can get all sorts of multimedia files from a web server.
coded. • Updating the documents soon became very tedious. • Eg. Current date, Good morning. • Want to be able to collect info on the web page as well. • ie. web pages needed to be dynamic & interactive.
let the web server know that certain portions of a web page are PHP & needs to be treated by the PHP interpreter • Opposite of interpreted language is a compiled language (Java, C, C++) • Must end each line with a semi-colon.
Normal PHP Tag <? ?> Short Tag • Commenting: Adding comments in the code that does not get printed out or interpreted by PHP. // Some Comment # Other comments /* More Comments */
Code • https://code.visualstudio.com/Download • Hello world with date/time (introduce PHP build-in function) • Hello world with user input (URL parameter) • Hello world with form GET • Hello world with form POST • Upload file with a form • Show uploaded image
• Within the same PHP file. • Variable - container of information, info can be of any type & can be changed anytime • Constants - Another kind of container where once the info is set, you cannot change it.
• Between different PHP files. • URL parameters (eg. http://localhost/hello.php?name=Michael) • HTML Form (POST/GET) • Cookie - Pieces of info related to a website visitor stored in the web browser • Session Variables - Information related to a website visitor stored in the web server
How big is the data? • How sensitive is the data? • Passed within the same file? • Passed between between pages in the same site? • Passed between different web sites (domain name)