On Wed, 30 Mar 2022 at 15:33, Guilliam Xavier <guilliam.xav...@gmail.com> wrote:
> Not really a "compelling reason why we should keep this inconsistency", but > I have occasionally relied on array autovivification *for sub-dimensions*, > I rely on this often when remapping data for analysis. These scripts are run a handful of times and discarded. Autovivication keeps the code short. Here's a snippet I wrote yesterday: $out = []; while ($row = $res->fetchAssociative()) { // ... $docId = $row['document_id']; if (!isset($out[$docId])) { $out[$docId] = [ 'application_id' => $row['application_id'], 'document_id' => $docId, 'filename' => $row['filename'], ]; } $out[$docId]['labels'][$row['document_rejection_reason_id']] = true; } Naturally I would prefer to keep this behaviour for arrays. Peter