I need to make a condition if
with the return of a function that is in a class:
File with class :
class teste
{
public function my_function()
{
...
if(...)
{
return 0;
}else{
return 1;
}
}
}
File index.php :
//Arquivo index.php
$chamada = new teste('...');
$retorno = $chamada->my_function($campos);
if($retorno==0)
{
echo 'error';
}
else
{
echo 'ok';
}
The operation of the class, as well as the function, is perfect. My problem is just getting the contents of the variable $retorno
and applying it to if
.
In this case, that return
of my_function
already prints the return itself on the screen. With this, I can not handle it with if
.
The problem is to just identify the return
of the function and make the IF in index.php