Hi all,
Here's my code:
if ($value==0)
{
$array = array(
"NAMES" => array("John", "Sara", "Mark"),
"LASTNAMES" => array ("Smith", "Lockwood", "Grant")
);
}
else
{
$array = array(
"NAMES" => array("John", "Sara", "Mark"),
"LASTNAMES" => array ("Smith", "Lockwood", "Grant"),
"ITEMPURCHASED" => array ("DVD", "Book", "Comic")
);
}
As you can see I'm reapeating the whole array code just because the ITEMPURCHASED element.
Is there a way not to repeat the whole array code? Can an if be used inside the array which adds just the ITEMPURCHASED element? If so, how?
Thanks a ton