6. Parameters and Arguments



It lets me continue, however it echoes this error:

Use of undefined constant Cole - assumed 'Cole' (line 11)Greetings, Cole!

Just wondering what's wrong/ why it lets me continue, Thanks!

        function greetings($name){
            echo "Greetings, "  . $name . "!";}


In your greetings() function call you are using an argument Cole

The interpreter will try to evaluate Cole as if it were a variable
the interpreter than run's into an error-situation as you have NOT pre-defined a variable Cole
and for your mercy will assume you used a string-Value 'Cole'
and it is even mentioned to you
Use of undefined constant Cole - assumed 'Cole' (line 11)Greetings, Cole!


When I called the greetings function like greetings("Cole") it came out normally on the other screen, is it still technically wrong?


It is all correct.... it is the essence of using a function

Function Talk


function greetings($name){
         /* Being of the FUNCTION-BODY
            PARAMETER $name is used as a =local= VARIABLE
            the =local= $name VARIABLE will get its VALUE 
            as you =call= the greetings() function
            using 1 ARGUMENT in this case the =string= Value "Cole"
                  echo "Greetings, "  . $name . "!";

you have defined a greetings() function which takes 1 parameter $name

As you call / execute the greetings function
and the greetings() function was defined as having 1 parameter
you will have to provide 1 argument in this case the string Value "Cole"

some quotes from the outer-world:

argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block


"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".