you got it right:
A function consist of two parts:
Declaration: the function's name, return type, and parameters (if any)
Definition: the body of the function (code to be executed)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So this is something that has been confusing me for a bit. After learning about hoisting and variable environments, I’m even more confused https://mobdro.bio/ .
Is a function declaration just: function functionName() {}
Or is it: function functionName() { code block }
??
From my understanding, it is the former, because isn’t the code block the function definition? But I want to be completely sure.
Please or to participate in this conversation.