What are parts of a PHP function named?

php, user-defined-functions

Solution

function foo(         // function declaration with function name
    SomeType $arg1,   // argument with type hint
    $arg2,            // argument
    $arg3 = ''        // argument with default value
) {                   // all above together: function signature
    // function body
}

Arguments may also be called "parameters" pretty much interchangeably. See:

- http://php.net/manual/en/functions.user-defined.php

- http://php.net/manual/en/functions.arguments.php

- http://php.net/manual/en/language.oop5.typehinting.php

Problem

I am having trouble figuring out a problem and it is because I don't know the correct terms to be searching for. Could someone please name all the parts of a PHP function and if I'm missing something please add it. ``` function my_function( non_variable $variable_one, $variable_two = "", $variable_three ) { /* inside stuff (Statement?) */ } ``` The answer I'm looking for would look something like this function: declaration my_function: name non_variable: Please Answer $variable_one: variable filled with non_variable The one I really need to know about are non_variable and $variable_one, Thanks! EDIT: more detail about the function ``` function my_function(custom_name $company) { $website = $company->company_website; /* Additional stuff */ } ```

Original source

Related problems