Sample output:
php kate.php c 20
cracklin'-cccccccccccccccccccccurling irons!
Source code:
<?php
// $argc is the count of arguments that were passed from the the user in unix terminal
if ($argc <
3 ) exit ("Please enter one letter (a-z) and a number (as big as you like), like this: php kjh_nt1b.php a 6 \n\n");
$letter =
$argv[1];
$number =
$argv[2];
echo ("\n\n");
// display a different word for each letter of the alphabet
if ($letter ==
"a" )
{
echo ("absolutely-am");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("zing!");
}
if ($letter ==
"b" )
{
echo ("blinkin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("rilliant!");
}
if ($letter ==
"c" )
{
echo ("cracklin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("urling irons!");
}
if ($letter ==
"d" )
{
echo ("diggity-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("oggies!");
}
if ($letter ==
"e" )
{
echo ("e");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("xtra-ordinary!");
}
if ($letter ==
"f" )
{
echo ("fartin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("antastic!");
}
if ($letter ==
"g" )
{
echo ("that's ");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("reat!");
}
if ($letter ==
"h" )
{
echo ("honkin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("eroic!");
}
if ($letter ==
"i" )
{
echo ("intensely-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ncredible!");
}
if ($letter ==
"j" )
{
echo ("jumpin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ammers");
}
if ($letter ==
"k" )
{
echo ("killer-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ickin'!");
}
if ($letter ==
"l" )
{
echo ("liberty-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("assos!");
}
if ($letter ==
"m" )
{
echo ("miracle-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ayhem!");
}
if ($letter ==
"n" )
{
echo ("nut-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("umbin'!");
}
if ($letter ==
"o" )
{
echo ("ogglin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ctopuses!");
}
if ($letter ==
"p" )
{
echo ("poppin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("andamonium!");
}
if ($letter ==
"q" )
{
echo ("querilous-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("uicknesses!");
}
if ($letter ==
"r" )
{
echo ("rambunctious-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("adioheads!");
}
if ($letter ==
"s" )
{
echo ("salutin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ailors!");
}
if ($letter ==
"t" )
{
echo ("terrific-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("amborines!");
}
if ($letter ==
"u" )
{
echo ("ultinate-e");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("lulations!");
}
if ($letter ==
"v" )
{
echo ("very-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("irulent!");
}
if ($letter ==
"w" )
{
echo ("wallopin'-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("hales!");
}
if ($letter ==
"x" )
{
echo ("excellent-e");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("clamations!");
}
if ($letter ==
"y" )
{
echo ("yipping-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ellowtails!");
}
if ($letter ==
"z" )
{
echo ("zipping-");
// display the chosen letter times the chosen number within the context of the word
$count =
0;
do {
echo ($letter);
$count =
$count +
1;
}
while ($count <=
$number);
echo ("ebras!");
}
echo ("\n\n");
echo ("\n\nThat was GREAT! Try again!\n\n");
?>