Calling a function before it is declared
php
Solution
It doesn't matter where you declare your functions in PHP in most cases, as you've just proved :)
Take a look at this page for more details. The key point:
Functions need not be defined before they are referenced, except when a function is conditionally defined as shown in the two examples below.
Problem
The following code runs in PHP ``` <?php $foo = "Chocolate milkshake"; go($foo); function go($param) { echo $param; } ?> // Output: chocolate milkshake ``` See this Demo http://codepad.viper-7.com/ToApZa This code runs without errors and prints specified output, why? I thought this "function hoisting" only occurred in JavaScript