简单的PHP函数调用不再工作[关闭]

class blah{

    function a( x ){
    $variablename = b();
    ....
    }

    function b(){
    echo("why is this code (first line of function b) seemingly unreachable");
    ....
    }
}

it works fine when executed on a local server but not otherwise!?

You are missing dollar signs ($) on all variables.

I'm actually amazed it worked on local.

$variable = $this->b();

if you call it from a non-static context. otherwise

$variable = self::b();

Give this a try:

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");