使用相同的条目在同一个类中调用2个函数

lets imagine i have this functions

class xx {
    function one() {
        echo "hello";
    }
    function two() {
        echo "how are you";
    }
}

if i do this

$call = new xx;
$call->one();

this will print hello on the page but if i want to print hello how are you can i do something like this?

$call->one()->two();

??? because i tried that and it prints me hello only, how can i call the second function with one sentence only? also tryed

$call = new xx();
$calboth = $call->one();

$callboth->two();

but just print hellohello anyway, so how can i do it? to print both? my point is not printing but making 2 functions work in same call

for example function dbconnect and login or dbconnect and register, inside same class and include the class php on main file and call only with something like i said before

$login = new system;
$login->dbconnect()->login();

thanks for all awnsers

To chain methods, you need to return an instance of the class:

class xx {
    function one() {
        echo "hello";
        return $this;
    }
    function two() {
        echo "how are you";
        return $this;
    }
}

Then this should work:

$call = new xx;
$call->one()->two();