On 11/21/2026 8:13 PM, Lawrence D’Oliveiro wrote:
> On Sat, 21 Nov 2026 17:32:01 -0500, Arne Vajhøj wrote:
>
>> PHP & &&
>> | ||
>> and(**)
>> or(**)
>>
>> **) do not use ever
>
> How many things are there in PHP that one might classify as “do not
> use ever”?
Several.
> Here’s another one: “+” on arrays. Yes, it’s defined. Defined as what?
It merges arrays. With slightly different semantics than array_merge.
I think it mostly makes sense for associative arrays. It is weird for
indexed arrays.
$ type crazy2.php
<?php
$a = [ 'A' => 1, 'B' => 2, 'C' => 3 ];
$b = [ 'C' => 4, 'D' => 5 ];
$c = $a + $b;
print_r($c);
$d = array_merge($a, $b);
print_r($d);
?>
$ php crazy2.php
Array
(
[A] => 1
[B] => 2
[C] => 3
[D] => 5
)
Array
(
[A] => 1
[B] => 2
[C] => 4
[D] => 5
)
$ type crazy3.php
<?php
$a = [ 'A' ];
$b = [ 'B', 'C' ];
$c = $a + $b;
print_r($c);
$d = array_merge($a, $b);
print_r($d);
?>
$ php crazy3.php
Array
(
[0] => A
[1] => C
)
Array
(
[0] => A
[1] => B
[2] => C
)
Arne