PHP Chapter 1


"; print "I like " . FAVORABLE_SOMETHING . "'s."; print "
"; print "
PHP Items Below: "; print "
My Name Length: " . "$FULL_NAME_LENGTH"; print "
My Normal Name: " . "$FULL_NAME"; print "
My Upper Name: " . "$FULL_NAME_UPPER"; print "
My Lower Name: " . "$FULL_NAME_LOWER"; print "
"; print "
Rounded 9/7: " . "$VALUE97_ROUNDED"; print "
Formatted 3005: " . "$VALUE3005_FORMATTED"; print "
"; print "
Variable Sandwich: " . "$VARIABLE_SANDWICH"; ?>

Difference of PHP Quotes

Single Quotes

Is used to display the literal words that are typed, rather than trying to interpret them into their actual values or processes

" ?>

Double Quotes

Is used to interpret the values not literally, and will take whatever its given and go through the implemented functions and processes that each value has


Debugging of PHP

Running through URL

PHP code should be ran through web server applications, as it will show the result of the code's execution.

Version of current PHP

Incompatiable verisons play a role in how programs run, as some older functions way be deprecated. Newer verisons have fixed bugs and issues, which it will likely cause errors if two different versions run together.

Turn on "display_errors"

It will help further debug, allowing for further detail of a bug or problem that needs more investigation.

Check HTML source

It is important to check the source of the HTML, as sometimes the website may not be updating correctly, or could be missing some code you've already implemented.

Trust Errors

Acknowledging warnings and errors provided by the console is vital, as if they are ignored it could cause alot more problems than it should.

Break a Leg

Taking breaks is important, as sometimes giving yourself fresh air or time to ponder can give enough room for an answer.


What is $_SERVER

Short Description

It is a superglobal array variable that stores the information about the server and environment.

Why is it used

Commonly used to help debug and determine certain properties.

Information Displayed

An example below is the following usage of "HTTP_USER_AGENT". There are many other lists provided in PHP documentation.