Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Escaping array dot notation #4588

Merged

Conversation

iRedds
Copy link
Collaborator

@iRedds iRedds commented Apr 20, 2021

Description
Sometimes an array key can contain a dot. In this case, you cannot access the value of this key using dot notation.
This PR makes available keys containing a dot, with dot notation.

$data = [
    'foo' => [
        'bar.baz' => 23
    ],
];

// Returns: 23
$barBaz = dot_array_search('foo.bar\.baz', $data);

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

system/Helpers/array_helper.php Show resolved Hide resolved
system/Helpers/array_helper.php Outdated Show resolved Hide resolved
@MGatner MGatner merged commit 556829b into codeigniter4:develop Apr 21, 2021
@iRedds iRedds deleted the feature/escape-array-dot-notation branch April 29, 2021 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants