Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page
Why Learn PHP?
► It is easy to learn, high-level and powerful. As you can see from the example below, less than 30 lines of code are required to output a sorted letter frequency histogram from arbitrary text.
<?
if(($f = @fopen(__FILE__, "r")) == false)
die("Could not open file\n");
$map = array();
while(($line = fgets($f)) != false)
{
for($n = strlen($line), $i = 0; $i < $n; $i ++)
{
if(($c = strtolower($line[$i])) >= 'a' && $c <= 'z')
{
if(!isset($map[$c]))
$map[$c] = 0;
$map[$c]++;
}
}
}
fclose($f);
arsort($map);
foreach($map as $letter => $count)
printf("Letter: '%s', Count: %d\n", $letter, $count);
?>
And output:
Letter: 'e', Count: 23 Letter: 't', Count: 17 Letter: 'i', Count: 16 Letter: 'f', Count: 16 Letter: 'l', Count: 15 Letter: 'n', Count: 15 Letter: 'a', Count: 14 Letter: 'r', Count: 14 Letter: 'o', Count: 13 Letter: 'c', Count: 11 Letter: 's', Count: 11 Letter: 'p', Count: 9 Letter: 'm', Count: 6 Letter: 'u', Count: 4 Letter: 'd', Count: 3 Letter: 'h', Count: 2 Letter: 'w', Count: 2 Letter: 'z', Count: 1 Letter: 'y', Count: 1 Letter: 'g', Count: 1
► It has been used to develop some of the most popular websites and platforms in the world. Some examples:
► PHP is quite popular. As of August, 2021 the TIOBE index of programming popularity lists the top 8 as being:
► ONLINE RESOURCES
► SOFTWARE