I am new to php classes, arrays, etc., so forgive me if I do not use the correct terminology. I am looking for how to easily assign values ββto properties from a class, not depend on if statements.
For instance:
Suppose I have an instance of a class test, and "test" has the "employee" property (I hope this is the correct way to call it), and the employee has a complex type.
So, I have something like:
$test -> employee = array('Age' => '30', 'Sex' =>$sex, 'nationality'=>$nationality, 'maritalstatus'=>$status, etc, etc)
The problem that I have here is that if "Age", "Sex", "Citizenship", etc. are not always present, and I only want to assign values ββto them when they have something assigned , and I do not want to use If for each combination of non-empty values ββ... (this is a brief example, but I have a lot of these attributes, or whatever they were not called, and too many βifβ combinations are too dirty) ...
I send these values ββlater as a soap request and I don't need empty xml tags ...
My apologies if my terminology is incorrect, but I hope that I was clear enough for someone there to help me!
Thanks in advance, Pablo
Pablo source share