I'm trying to make an IF
statement using the function empty()
and a ||
. I'm not sure the problem is between the operator and the function, but I don't have any leads on anything else.
Each check in the IF
is working individually.
Here is what I want to do, but I have an error :
if(empty($arrayA['somevalue']) || ($x->val1 == 0 && intval($x->valInteger) > 0)){
$arrayA['somevalue'] = $y;
}
The error :
Fatal error: Uncaught Error: Call to undefined function [path] () in [path]/ProductsImporter.php:648 Stack trace: #0
Line 648 is the IF
I also tried with is_numeric()
, but it doesn't change a thing.
My quick fix, which is working fine, but it's so ugly, is this :
if(empty($arrayA['somevalue'])){
$arrayA['somevalue'] = $y;
} else if ($x->val1 == 0 && intval($x->valInteger) > 0){
$arrayA['somevalue'] = $y;
}
Aucun commentaire:
Enregistrer un commentaire