Are both same in PHP?

Are these both same?

$this->query($result, $connection);
return $result;

and,

return $this->query($result, $connection);

First code works fine, but, when I am running last code, I am getting error.
Is it possible?

I think both are same…
Isn’t it?

Someone please…

No, they aren’t the same.

The first code calls the query method, then returns the $result variable. The second code calls the query method, then returns whatever the return value of that method was.

they’re not even close to the same.

the second returns the output of whatever the query method does.

the first returns whatever $result is - a variable or a resource.

Thanks to all of you.
This was my silly mistake.
Yes, You all are right.