I can not understand why nothing is displayed. There is an announcement, there is a call with the parameter
$ff = 'ground zero'; function method1($a) { echo($a); } function method2 () { method1($ff); } method2(); I can not understand why nothing is displayed. There is an announcement, there is a call with the parameter
$ff = 'ground zero'; function method1($a) { echo($a); } function method2 () { method1($ff); } method2(); The $ ff variable is not declared inside the mathod2 method. If you want to use a global variable inside a function, explicitly declare it as global:
$ff = 'ground zero'; function method1($a) { echo($a); } function method2 () { global $ff; method1($ff); } method2(); Read more in the PHP documentation .
Source: https://ru.stackoverflow.com/questions/784510/
All Articles