I have a structure like so:
main.php
include_once
func1.php
include_once
func2.php
These two files are include
'd inside main.php
.
I get the error below when I call a function switchboard()
from func1.php
inside finc2.php
.
Fatal error: Uncaught Error: Call to a member function switchboard() on null in func2.php:16
Stack trace:
#0 main.php(60): decode_func('{"auth":"...)
#1 {main} thrown in func2.php on line 16
Line 16 is where I call the function from func1.php
inside func2.php
—
switchboard() {}
. Is there a way to fix this besides include
ing func1.php
inside func2.php
?
func2.php
function decode($var) {
if() {return $var;}
else { $erm->switchboard('101', $var); }
}
func1.php
$erm = new CLASS() {
function switchboard($id, $var) {
if() {}
else {}
}
}