So if I have the following code:
<?php
function someFunction()
{
//lots of lines of code
}
if ($someBooleanVariable)
{
//some random code
}
else
{
someFunction();
}
?>
Question 1: Am I correct to assume that the server will first load the whole function, and then possibly not even use it?
Question 2: If that were the case, wouldn't it often be more efficient to place the function code inside the brackets "{}" after the else in the previous code? (assuming that the code would only run once and wouldn't need to be used anywhere else).
Since the code would only load and run if the "$someBooleanVariable" was FALSE, I assume that the server would be less used if the code wasn't in the function but rather inside the brackets after the "else". However I am basing that on the assumption that the server is loading the function code automatically every time since it is at the top of the page, which might be the root of the question.