|
|
|
|
|
by qwertox
315 days ago
|
|
I don't see how this is hard to reason about, assuming this is the resulting code when using variables: $tags = ...array_column($arr, 'tags');
$merged_tags = array_merge($tags);
$unique_tags = array_unique($merged_tags);
$tag_values = array_values($unique_tags);
It also makes it easier to inspect the values after each step. |
|
With PHP allowing variable initialization in one branch but not the other, and continuing execution by default when an undeclared variable is passed, declaring more variables can lead to an annoying class of bugs that would require significant (breaking) changes to the core language to completely eliminate.