class blah{
function a( x ){
$variablename = b();
....
}
function b(){
echo("why is this code (first line of function b) seemingly unreachable");
....
}
}
在本地服务器上执行时它工作正常,但不是!
class blah{
function a( x ){
$variablename = b();
....
}
function b(){
echo("why is this code (first line of function b) seemingly unreachable");
....
}
}
在本地服务器上执行时它工作正常,但不是!
$variable = $this->b();
如果您从非静态上下文中调用它。否则
$variable = self::b();
您在所有变量上都缺少美元符号 ($)。
我真的很惊讶它在本地工作。
试试这个:
class blah{
function a( $x ){
$this->b(); // <---- added this ...
}
public function b(){
echo("why is this code (first line of function b) seemingly unreachable");
}
}
$test = new blah;
$test->a("some_string");