Lesson 26 of 3087%

(Progress persistence is disabled until Phase 9)

PHP
Beginner

Parameters

Learn about Parameters in PHP.

PHP is a powerful server-side language. In this lesson, we will cover Parameters.

Real code examples

<?php
function familyName($fname, $year) {
  echo "$fname Refsnes. Born in $year \n";
}

familyName("Hege", "1975");
familyName("Stale", "1978");

// Default argument value
function setHeight($minheight = 50) {
  echo "The height is : $minheight \n";
}
?>

Common mistakes

Make sure you include the <?php tag when writing PHP!

Try It Yourself

You can experiment with this in the Playground.

Lesson Progress

Take QuizBuild a PHP Project