PHP assignment answers
Introduction to PHP
Today's assignment was to create a function that takes a name, an age, and a height, and outputs a sentence using all of these variables. Also, to call the function using a combination of variables and literals.
Without further ado, let's take a look at the script:
<?php function describeperson($name, $age, $height) { echo 'Did you know that ' . $name . ' is ' . $age . ' years old, and only ' . $height . ' tall?'; } describeperson('John Doe', '22', '5ft'); ?>
This article is issued from Wikiversity - version of the Sunday, April 13, 2008. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.