Thursday, February 24, 2011

trying to learn PHP

I'm trying to learn PHP. Partly to help enhance my church's website (www.thebrookchurch.com), but also because I've been wanting to do something like this for quite a while.

Here's what I've learned so far regarding PHP.
1. PHP is coding that is interpreted by a webserver and then turned into HTML.
2. PHP echo is a simple method to display something.
3. Arrays are listings of items and I'm sure this will be of great importance later.
4. Each line in PHP must end with ;
5. To force a new line, you need a "
" in the PHP code.
6. array_rand will generate a random key from an array, but the key by itself is useless!!!
7. however it can be used to return the value (the truly meaningful information) from an array like so: echo $greeting_array[(array_rand($greeting_array))]; (greeting_array is an array of text items)
8. while loops are cool like this:
while($cnt != 25)
{
echo "$cnt
";
$cnt = $cnt + 1;
}
// output the last value where $cnt = 25
echo "$cnt
";



That's about all for now.
Later,
Andy

No comments: