You have passed data to built in functions.  For example print_r($something).  They give the function more information on what you want them to do.  In this case that is what to print.

You can also pass data to your own functions as parameters. In phpfunctions.php go to the function (at the top) and:

Try the page.  You should see an error/warning about a missing argument.  The data inside the brackets when a function is called is known as an argument.  Our function has a variable but no data has arrived.  The code still runs but the paragraph is empty (and you get warning messages).

To fix this you need to pass data to the function so find the place where you called the function and change that line from:




Save, upload and try and the page should now work again.  Add a new line of code just under the last one you edited:


Try it and you get two paragraphs both created by the same function but showing different text.

Multiple arguments

You can pass more than one piece of data by separating them by commas.  Change the function argument list from this:

function saySomething($wordToSay) {

to this:

function saySomething($wordToSay, $name) {

Now change this line:


to this:

saySomething("Hello", "Fred");

Try it and you will get an error.  The function now expects two parameters but the second saySomething line sends only one ("Goodbye").  Comment out that line.

Try it again and you should understand why the name does not show up even though the error is gone.  Fix it by changing the echo line:

echo "<p>$wordToSay $name</p>";

Try it.

Remember the use of quotes: