1// If you are creating new array then try this :
2$arr = array("key" => "value");
3
4// And if array is already created then try this :
5$arr["key"] = "value";
1// laravel
2
3use Illuminate\Support\Arr;
4
5$array = Arr::add(['name' => 'Desk'], 'price', 100);
6
7// or this one:
8
9
10$array = Arr::add($array, 'price', 100);
11
12
13