"; //store "Hello" in $greeting $greeting = "Hello"; //store your name in $name $name = "Mihaela"; //use $greeting and $name variables to display // "Are you xxx? Hello to you!!!!" //where xxx is your name. echo "Are you $name? $greeting to you!!!
"; echo "*****************************
"; } one( ); /* * Displays a given greeting and name * @param $greeting string contains a greeting word * @param $name string contains a person's first name */ function two($greeting, $name) { echo "*** Executing two( ) ***
"; //use $greeting and $name paramaters to display same text as function one( ) echo "Are you $name? $greeting to you!!!
"; echo "*****************************
"; } two("Hi", "Sarah"); two("Salut", "Lola"); two("Ciao", "Carla"); /* * Displays a given greeting and within a two formatting strings * @param $greeting string contains a greeting word * @param $name string contains a person's first name */ function three($greeting, $name) { echo "*** Executing three( ) ***
"; //use $greeting and $name parameters to display the same text as function two( ) //use the here-doc construct to display three lines. //first and third line have = character repeated 15 times. //line in the middle is produced by using $greeting and $name parameters. //show the greeting string in bold by using HTML tag //show the name string in italics by using HTML tag echo <<<_END ==============================
Are you $name? $greeting to you!!!
=============================
_END; echo "*****************************
"; } three("Hello", "Jonathan"); /* * Makes use of arithmetic, logical, and comparison operators to practice with * expressions in PHP. */ function four( ) { echo "*** Executing four( ) ***
"; $x = 3; $y = 1; $isHot = true; $isCold = false; $a = 2.5; $b = 3.2; echo "$x + $y = ". ($x + $y) . "
"; //demo other integer arithmetic expressions by using * and - operators. echo "$x * $y = ". ($x * $y) . "
"; echo "$x - $y = ". ($x - $y) . "
"; //demo boolean expressions by using AND and OR operators with $isHot and $isCold. echo "\$isHot has value $isHot
"; echo "\$isCold has value $isCold
"; echo "$isHot || $isCold = " . ($isHot || $isCold) . "
"; //demo decimal expressions by using / and + operators with $a and $b echo "$a + $b = " . ($a + $b) . "
"; echo "$a / $b = " . ($a / $b) . "
"; //demo comparison expressions by using < and >= operators with $x and $y. echo "$x < $y = ". ($x < $y) . "
"; echo "$x > $y = ". ($x > $y) . "
"; echo "*****************************
"; } four( ); /* * Demonstrates the usefulness of escape characters. */ function five( ) { echo "*** Executing five( ) ***
"; //display the following two lines, exactly as they are shown below: // What's your favorite band? "Beatles". // Never used \. What's a backslash used for? //do it three times. //first time use single quotes. echo 'What\'s your favorite band? "Beatles."
'; echo 'Never used \. What\'s a backslash used for?
'; //second time use double quotes. echo "What's your favorite band? \"Beatles\"
"; echo "Never used \. What's a backslash used for?
"; //third time use here-doc construct. echo <<<_END What's your favorite band? "Beatles".
Never used \. What's a backslash used for?
_END; echo "*****************************
"; } five( ); ?>