Question: I need help with this php file, coding is so confusing to me. Please help!! Thank You!! To create a script that contains two functions:
I need help with this php file, coding is so confusing to me. Please help!! Thank You!!
To create a script that contains two functions:
1. Create a new document in your text editor. Type the
declaration,
element, header information,
and
element. Use the strict DTD and Two Functions
as the content of the
element.
2. Add the following script section to the document body:
?>
3. Add the first function to the script section as follows. This
function writes a message to the screen using an argument
that will be passed to it from the calling statement.
function displayMessage($FirstMessage) {
echo "
$FirstMessage
";
}
4. Add the second function, which displays a second message, to
the end of the script section. In this case, the message (This
message was returned from a function.) is defined within the
function itself. The only purpose of this function is to return
the literal string to the calling statement.
function returnMessage() {
return "
This message was returned from a
function.
";
}
5. Add the following three statements to the end of the
script section. The first statement displays the text string
This message was displayed from a function. in the Web
browser. This statement does not receive a return value.
The second statement assigns the function call to a variable
named $ReturnValue, but does not send any arguments
to the function. The third statement writes the value of the
$ReturnValue variable to the screen.
displayMessage("This message was displayed from a
function.");
$ReturnValue = returnMessage();
echo $ReturnValue;
6. Save the document as TwoFunctions.php in the Chapter
directory for Chapter 2, and then upload the document to the
Web server.
7. Open the TwoFunctions.php file in your Web browser by
entering the following URL: http:///PHP_
Projects/Chapter.02/Chapter/TwoFunctions.php. You should
see the Web page shown in Figure 2-2.

Two Functions - Mozilla Firefox Eile Edit View History Bookmarks Iools Help C X http://student200.ucb.sephone.us/PHP_Projects/Chapter.02/Chapter/TwoFunctions.php This message was displayed from a function. This message was returned from a function Done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
