C S 329E Chapter Notes - Chapter 5: Mysql, Semicolon
PHP: Quick Reference Guide
Background Information
History
• Created in the 90’s by Rasmus Lerdof
• Wanted to make common web tasks easier to create and less repetitive to code
• Aimed to reduce the amount of logic required for each function
Functionalities
• Can embed other languages such as C or Python
• Allows user to use a database such as MySQL or Oracle
• Can be embedded into HTML to perform specific tasks or functions
Advantages
• Can be as simple/complicated as the user makes it depending on the functions and add-ons they use
• Can edit with commercial IDE’s (when page is straight HTML)
• Runs on the server and can output different formats including HTML, images, files, etc.
Common Uses
• Used to develop websites and tasks
• Found most commonly amongst web developers or IT positions
• Tasks possible with PHP:
§ Homepages
§ Database front-ends on the web
§ Command line shell scripts with extra functionality
§ Basic GUI development
Influential Applications written in PHP
• WordPress: One of the most influential CMS(Content Management System) tool. 22% of websites
on Internet are created using WordPress
Development Environment
The development environment for PHP varies based on depending on its intended function.
To develop locally
To develop on the web
To use PHP
for command line scripting
• PHP
• Web Server
• Database
(optional)
• PHP
• Web Server
• Web Browser
• Database (optional)
• PHP
• Command Line Executable
• PHP-GTK Extension (for
desktop GUI application
development)
PHP is available for free download online. Most operating systems come with a web browser preinstalled.
Web servers are available for rent or Apache offers a free, open-source alternative. There are various
database options to choose from, including the open-source relational database system, MySQL.
Language Syntax
All code must begin with <?php and end with ?>
Data Types
PHP has the following Data Types:
• String (Sequence of characters)
• Integer (Non-decimal number)
• Float (floating point numbers - also called double) (Contains decimal points)
• Boolean (Can be true or false)
• Array (Stores multiple values in one single variable)
• Object (Stores data and information on how to process that data) (Must be declared)
• NULL (Has no value assigned to it)
• Resource (Not an actual data type, stores a reference to functions/resources external to PHP)
• Date/Time: string date ( string $format [, int $timestamp = time() ] )
Document Summary
History: created in the 90"s by rasmus lerdof, wanted to make common web tasks easier to create and less repetitive to code, aimed to reduce the amount of logic required for each function. Functionalities: can embed other languages such as c or python, allows user to use a database such as mysql or oracle, can be embedded into html to perform specific tasks or functions. Common uses: used to develop websites and tasks, found most commonly amongst web developers or it positions, tasks possible with php: Command line shell scripts with extra functionality. Influential applications written in php: wordpress: one of the most influential cms(content management system) tool. 22% of websites on internet are created using wordpress. The development environment for php varies based on depending on its intended function. To use php: php, web server, database (optional, php, web server, web browser, database (optional) for command line scripting, php, command line executable, php-gtk extension (for desktop gui application development)