im making a function with some variables which has to be added to an array
the array is called $params this is my attempt however im getting erros:
$params = array( 'Target' => 'Report' ,'Method' => 'getStats', $fields == null ? 'fields' => $fields : 'gg' ,'filters' => array( 'Stat.affiliate_id' => array( 'conditional' => 'EQUAL_TO' ,'values' => array( $affId )) ,'Stat.date' => array ( 'conditional' => 'BETWEEN' ,'values' => array( $startDate ,$endDate ) ) ) ,$ascSorting //group by day ,'groups' => array( $grouping_type) ,'totals' => true ); im getting an error at my shorthand if:
$fields == null ? 'fields'=> $fields : '' My goal is to get something like this:
($fields == null ? 'fields'=>$fields : '') So if $fields is null or not set the index fields should not even be set in the array