Skip to content
Permalink
Browse files

Optimized hash extract of {n}.field for PHP 5.5+

  • Loading branch information...
jrbasso committed Sep 7, 2014
1 parent 1fa7a93 commit 0a1624fd5378f359cf80510d12002664eb97bad8
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/Utility/Hash.php
@@ -114,6 +114,9 @@ public static function extract(array $data, $path) {
}
if (strpos($path, '[') === false) {
if (function_exists('array_column') && preg_match('|^\{n\}\.(\w+)$|', $path, $matches)) {
return array_column($data, $matches[1]);
}
$tokens = explode('.', $path);
} else {
$tokens = String::tokenize($path, '.', '[', ']');

0 comments on commit 0a1624f

Please sign in to comment.
You can’t perform that action at this time.