I am trying to create an array like the following, but this time dynamically
$taInputs = array(
"fieldOne" => array($this->fieldOne, '0,166,198'),
"fieldTwo" => array($this->fieldTwo, '0,166,198'),
"fieldThree" => array($this->fieldThree, '0,166,198'),
"fieldFour" => array($this->fieldFour, '0,166,198')
);
So, I create my Array Object
$this->data = array();
And then I have the following loop
foreach($this->document->documentData as $documentData)
{
$this->data = array(
$documentData->key => array($documentData->value, '228,47,57')
);
}
At the moment, if I output the data array after the foreach loop, I only see the last entry, so it is overwriting it on each loop.
How can I create the array I am after without it being overwritten?
$this->data[] = ....perhaps?