Web Systems Development (CSC-215) Lecture 2: Introducing PHP Wednesday 31st January 2018
Setting up your environment Server Text editor IDE Remote server
Server WAMP MAMP LAMP Windows, Apache, MySQL, and PHP Mac, Apache, MySQL, and PHP LAMP Linux, Apache, MySQL, and PHP
Recommended Server WampServer http://www.wampserver.com/en/
Text Editor PSPad Sublime Text NotePad++
IDE Aptana Studio PHP Designer NetBeans …
Remote Server http://www.000webhost.com/ http://www.heliohost.org/home/ Plus FTP client, e.g., FileZilla
Installing WAMP Download Run Setup
Go with default options
Choose the browser you want to use
Troubleshooting installation issues Install the Visual C++ 2012 redistributable before going ahead with the WampServer install http://www.microsoft.com/en-us/download/details.aspx?id=30679
Testing the WAMP Installation If your WAMP icon does not turn green, try switching Skype off and restarting the server
Incorporating PHP Within HTML Your document should have a .php extension
View Source
Basic syntax overview
Comments
End of statement semi-colon
$ at start of variable names
String Variables
Numeric Variables
Arrays
Multi-dimensional arrays
Variable naming rules
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
String Concatenation
String Types Single quote evaluates string as a literal.
String Types Double quote enables evaluation of any variables included inside.
Escape Character \t, \n and \r can also be used
Multiple Line Commands
Multiple Line Commands
Multiple Line Commands
Multiple Line Commands
Variable Typing Loosely typed Variables need not be declared before they are used
Automatic Conversion
Automatic Conversion
Constants
Predefined Constants
print Can be used within complex expressions unlike echo
Lecture content adapted from chapters 2 & 3 of Learning PHP, MySQL, JavaScript, CSS & HTML5, 3rd Edition, by Robin Nixon.