Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed PHP Functions!
You have completed PHP Functions!
Preview
Sometimes if an argument is not passed through, and you want it to have a starting value, no matter what, this is where a default argument will come to your assistance.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Sometimes, if an argument is not passed
through, but
0:00
you want the function to have a starting
value no matter what,
0:02
this is where a default argument will come
to your assistance.
0:06
Now you can see it's just hello, dollar
sign, name.
0:09
Then, we'll simply add name equals and
0:13
then whatever our definition for the
default argument should be.
0:17
In this case we'll just do friend that way
I can pass through an argument like this.
0:21
So I'll say hello and then Mike.
0:25
That way it'll say Hi, Mike, how's it
going?
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up