Add a key to the current array

I get POST with multiple inputs.

<input name="options[]" type="text"/>
<input name="options[]" type="text"/>
<input name="options[]" type="text"/>

PHP:

$i = 0;
foreach ($_POST['options'] as $option) { 

    $yok[] = array('sik'. $i++ => $option); 

}

$result = json_encode($yok);

// $result : ' [{"sik0":"op1"},{"sik1":"op2"},{"sik2":"op3"},{"sik3":"op4"}]  ';

My Goal:

// $result : ' {"sik0":"op1", "sik1":"op2", "sik2":"op3", "sik3":"op4"} ';

What do I need to order my goal?
I’ve looked at many arrays, but unfortunately I didn’t succeed.

Try using $yok['sik' . $i++] = $option; instead of $yok[] = array('sik'. $i++ => $option).
Hope this helps! :smiley: