Ajouter un élément au tableau en php
<?php
$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
Dark Dugong
<?php
$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
$a = array("key1"=>"value1", "key2"=>"value2");
// to append "key3" - "value3":
$a["key3"] = "value3"
<?php
$a=array("a"=>"red","b"=>"green");
array_push($a,"blue","yellow");
print_r($a);
?>
use Illuminate\Support\Arr;
$array = Arr::add(['name' => 'Desk'], 'price', 100);
// or this one:
$array = Arr::add($array, 'price', 100);
// If you are creating new array then try this :
$arr = array("key" => "value");
// And if array is already created then try this :
$arr["key"] = "value";
<?php
$image[0] = $image[0].','.$filename;
?>