Practice Makes Perfect


Functions Part II, Practice Makes Perfect

Why does my code output/print a 1 at the end?

      function aboutMe($name, $age) {
        echo print "Hello! My name is " . $name . " and I am " . $age . " years old.";
      aboutMe("brandon", 28);

My Code outputs/prints a 1 to editor box:
Hello! My name is brandon and I am 28 years old.1


echo and print in the same statement does not look right.


Picking up where @mtf guided you, combining those instructions does this:

  1. Concatenate the string.
  2. Then print the result to the browser.
  3. Then echo the return value of print, which is 1 (see the manual here).


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.