I have this code running in CodeIgniter:
for($j=0;$j<count($detials);$j++){
$newValues = array(
'Description' => $detials[$j]
);
}
currently it outputs this:
Array ( [Description] => Array ( [0] => this [1] => is [2] => a [3] => name ) )
I want the loop to create this:
$newValues = array(
'Description' => $detials[1]
'Description' => $detials[2]
'Description' => $detials[3]
);
How do I do this?
I am not sure, but I think you may be trying to do this:
for($j=0;$j<count($detials);$j++){
$newValues[] = array('Description' => $detials[$j]);
}
Which would give you this array:
$newValues = array(
array('Description' => $detials[1]),
array('Description' => $detials[2]),
array('Description' => $detials[3])
);