使用if与数组并添加额外区域

 $contactData = array(
        'firstname'             =>  $fname,
        'lastname'              =>  $lname,
    );

I fill out my array with the information that I send from my html form with that code. I`m trying to add if so I can add additional information with it like;

 $contactData = array(
        'firstname'             =>  $fname,
        'lastname'              =>  $lname,
    );

 if ($i='5') {$contactData = array('what' => 'info');}

it probably won't work like this but I don`t know how can I get it working either. Anybody can help me with this ?

The correct syntax is:

if ($i=='5') {$contactData['what'] = 'info';}
if ($i == '5') {
    $contactData['what'] = 'info';
}