I have a sample code:
$array1 = ("key1", "key3");
$array2 = ("value1", "value3");
$array = array_combine($array1, $array2);
if(!isset($array["key2"])) {
$array["key2"] = "value2";
}
But result is error, how to fix it
array("key1"=>"value1", "key2"=>"value2", "key3"=>"value3");
You’ll have to specify that you wish that the arguments currently assigned to
$array1and$array2are to be used as arrays.Full example