I tried the last example above. Here was my comparable test:
function someFunc($options = [])
{
$options = array_replace([
"<br>", "<b>", "<i>", "<u>", "<hr>", "<span>"
], $options);
print_r($options);
}
here is the result:
>>> somefunc()
Array
(
[0] => <br>
[1] => <b>
[2] => <i>
[3] => <u>
[4] => <hr>
[5] => <span>
)
=> null
Yet looks what happens when you try to add a tag. Notice what happens to the original values. Element [0] is changed. The array is not added to:
>>> someFunc(["<div>"])
Array
(
[0] => <div>
[1] => <b>
[2] => <i>
[3] => <u>
[4] => <hr>
[5] => <span>
)
=> null
This would allow you to add an element to default option:
function someFunc($options = array())
{
array_push($options, "<br>", "<b>", "<i>", "<u>", "<hr>", "<span>");
return $options;
}
Here is what results:
>>> someFunc()
=> [
"<br>",
"<b>",
"<i>",
"<u>",
"<hr>",
"<span>",
]
---
someFunc(["<div>","<table>"]);
=> [
"<div>",
"<table>",
"<br>",
"<b>",
"<i>",
"<u>",
"<hr>",
"<span>",
]
this way, the default values get added to.
$var3 = array(1,2,3,4)would work though.