I have a function within another function which is inside a class in PHP
, the funcion1
receives the parameter of a query $row['fila1'];
that assigns a variable $ id.
When printing $ idgasto inside the function, it sends me the value of this query but when wanting to use the value outside the function, it sends it to me as 1 or 0, which does not help me.
function insert($idgasto){
$idgasto1=($idgasto*1);//lo convierto a entero
echo $idgasto1;//se imprime el valor con exito
return $idgasto1;
}
when I call the function and I want to use the value of $idgasto
just send me 0
insert();
echo $idgasto;//me imprime 0