private function teste()
{
echo 'teste';
}
This method just prints something does not return value, so the following line makes sense
$variavel = $this->teste();
You should change the test method to the following way
private function teste()
{
return 'teste';
}
And in terms of wasting memory you would be wrong because once the method or function reaches the first return or at the end of your body, all variables that are in its scope would be released from memory.
Variables declared within a function are called local variables of the function. To learn more about variable scope.
Depending on the update of the question description , you always assign a value to a variable when you intend to reuse it more than once, or to make the code more readable .
Assigning a variable just to give it more readability would not be memory wasted, because as I said the variables will only be in memory while the context in which it has been declared is being executed (eg a function or method).
If it was a few decades ago, the answer would be yes due to hardware limitations, but today that's no problem, readability of the code is more important.