Back to index

PHP

PHP is a scripting language used for web development. PHP has it's origins in 1995 when a guy named Rasmus Lerdorf began developing it under the name "Personal Home Page Tools." In this lesson we will look at a few very simple tricks that can be done using PHP. BTW, when using PHP your page must have a .php extension instead of the usual .html extension.

Here's a quick PHP snippet using the echo command:

AGENT PHP, reporting for service!

Inspect the source code for this page to see how that works!

There was 28 days in February 2005
There was 29 days in February 2012

PHP provides all sorts of useful functions and commands. Take a look at this example:

Decimal 10 equals hexadecimal a.
Decimal 111 equals hexadecimal 64.
Decimal 255 equals hexadecimal ff.
---------
Hexadecimal aaa equals decimal 2730.
Hexadecimal a9f equals decimal 2719.
Hexadecimal fbc4 equals decimal 64452.

Here's a fun string function for you to try out:

trona --> argus
strong --> string
face --> fact

Interating Through An Array

Study the code for the following section carefully!
------------
1) Indiana
2) Maine
3) Florida
4) Alaska
5) Arizona
-------------
Here is a basic date example:
----------------
Saturday, November 23, 2024
----------------


ASSIGNMENT:

Using the dechex function, display the hexadecimal value for decimal values 100, 200, 300, 400... 2000. (That's 100 through 2000, counting by 100.) Iterate through these values using the following technique:

---------------------------------------
Current value of x: 100
Current value of x: 95
Current value of x: 90
Current value of x: 85
Current value of x: 80
Current value of x: 75
Current value of x: 70
Current value of x: 65
Current value of x: 60
Current value of x: 55