I'm a complete beginner so sorry if the way I word this is confusing. I'm working on my online computer science course right now and we're practising functions. What we're supposed to do is set three sentences to output three different variables inside the sentence
x is y years old and is z
Here's what I mean:
Obama is 50 years old and is president of the United States.
Bill Gates is 60 years old and is Founder of Microsoft.
Jacob is 20 years old and is a student.
This is the code that I currently have:
<?php
function displayStory($name) {
}
function displayAge($age) {
}
function displayJob($job) {
echo $name . " is " . $age . " and is " . $job . ".<br />";
}
displayStory("Obama");
displayAge("50");
displayJob("the President of The United States");
displayStory("Bill Gates");
displayAge("60");
displayJob("the founder of Microsoft");
displayStory("Jacob");
displayAge("20");
displayJob("a student");
?>
I'm sure there's an easier way to complete this and I know other ways to complete this, but we're supposed to use the function DisplayX to complete this.
Thank you in advance :)
displayStoryanddisplayAgeas there is no code within{}and you have written code indisplayJobbut in that function there is only one parameter i.e$jobwhat you need is a function likedisplay_details($name,$age,$job){,I hope it helps