Here is the array
$anArray = array( \"theFirstItem\" => \"a first item\", if(True){ \"conditionalItem\" => \"it may appear base on the condi
You can do it like this:
$anArray = array( "theFirstItem" => "a first item", (true ? "conditionalItem" : "EMPTY") => (true ? "it may appear base on the condition" : "EMPTY"), "theLastItem" => "the last item" );
unset the EMPTY array item if the condition is false
unset($anArray['EMPTY']);