Why is it that even though my code is like this:
if ( ! function_exists('get_values')){
global $str;
function getValues($getThem, $tpar, $vpiso, $tcomi, $tgas, $ttotal){
$totalPares = $tpar;
$ventasPiso = $vpiso;
$totalComisiones = $tcomi;
$totalGastos = $tgas;
$totalTotal = $ttotal;
$str = $totalPares . "," . $ventasPiso . "," . $totalComisiones . "," . $totalGastos . "," . $totalTotal;
return $str;
}
function getEm(){
return $str;
}
}
I can't override the value of $str. It always prints ¨a¨ if I try to echo it, and inside the "getEm" function it says it's an undefined variable.
This is the helper file in the codeigniter framework.
EDIT
which still gives me this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: str
Filename: helpers/helper_common_functions_helper.php
Line Number: 15