Skip to content

Unpack refactor and improved isAssoc documentation

Choose a tag to compare

@minwork minwork released this 29 May 21:53
· 52 commits to master since this release

Unpack

  • Replaced internal method argument with mode argument
  • Added 4 modes of handling array at highest nesting depth
    • UNPACK_ALL (default) - unpack every nested array
      $arr['foo.bar.0'] = 'a';
      $arr['foo.bar.1'] = 'b';
    • UNPACK_PRESERVE_LIST_ARRAY - preserve list type array
      $arr['foo.bar'] = ['a', 'b'];
    • UNPACK_PRESERVE_ASSOC_ARRAY - preserve associative array
      $arr['foo.bar'] = ['a' => 1, 'b' => 2];
    • UNPACK_PRESERVE_ARRAY - work as both of options above combined
  • For examples check out unpack test method testUnpack
  • Examples in documentation coming soon

isAssoc

  • Clarified in PHPDoc how both values of $strict flag works