I’m looking at code written by someone else and it declares an array this way (which I think is still a string, can someone confirm).
$array = "Label 1" . "~/" . "Label 2" . "~/" . "Label 3" . "~/" . "Label4";
Then later in the code, it does this
split('~/', $array);
Is there a valid reason why anyone would do it this way? I would normally declare it as an array from the start.
There is absolutely no defendable reason to do things this way instead of just
In fact it’s a very bad way of doing it, unless you can guarantee that the string
"~/"will never appear in the array’s elements.