Hi,
I'm new to php classes, arrays, etc, so pls excuse me if I don't use the correct terminology. What I'm looking for is how to assign easily values to properties from a class without having to depend on "if" statements.
For example:
Suppose I have an instance of a class test, and "test" has a property "employee" (hope this is the correct way to call it) and employee is of a complex type.
So, I have something like:
$test -> employee = array('Age' => '30', 'Sex' =>$sex, 'nationality'=>$nationality, 'maritalstatus'=>$status, etc, etc)
The problem I have here is, what if 'Age", 'Sex', 'Nationality', etc are not always present and I only want to assign values to them when they have something assigned, and I don't want to use If's for each combination of not empty values ...(this is a short example, but I have a lot of these attributes or whatever they are called and too many "if" combinations is too messy)...
I'm sending these values later as a soap request and I don't want any empty xml tags...
My apologies if my terminology is not correct, but I hope I've been clear enough for someone out there to help me out!
Thanks in advance, Pablo