PHP/Assignment Answers

From Wikiversity
Jump to navigation Jump to search

Introduction to PHP[edit | edit source]

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:


function describeperson($name, $age, $height) {
   echo 'Did you know that ' . $name . ' is ' . $age . ' years old, and only ' . $height . ' tall?';

describeperson('John Doe', '22', '5ft');