I am wondering how to put a foreach inside of an array. I've tried the following
$service_url = 'http://api.XXXXXXX/addData';
$curl = curl_init($service_url);
$curl_post_data = array(
foreach ($additional_fields as $name => $value) {
if (!empty($value)) {
'$name' => $value,
}
);
but its giving me the error unexpected T_foreach
.
Any ideas?