ustream / arr
Ustream 数组助手
0.1.2
2013-10-21 19:19 UTC
Requires
- php: >=5.3.0
- ustream/option: ~0.1.0
Requires (Dev)
- phpunit/phpunit: ~3.7.23
- squizlabs/php_codesniffer: ~1.4.7
This package is not auto-updated.
Last update: 2024-09-23 15:10:28 UTC
README
这是一个与数组相关的实用工具集合。
提取器
从深层嵌套数组中挖掘数据是繁琐的。 提取器库 提供了一种可编程和可组合的解决方案来解决这个问题。
访问嵌套结构中的简单 "路径" 数据
$sample = array( "foo" => array( "bar" => array( "baz" => "something" ) ) ); $extractor = new PathExtractor(array("foo", "bar", "baz")); $result = $extractor->extract($sample); // "something" # inside an Option instance $extractor = new PathExtractor(array("foo", "bar")); $result = $extractor->extract($sample); // array("baz" => "something") # inside an Option instance $extractor = new PathExtractor(array("foo")); $result = $extractor->extract($sample); // array("bar" => array("baz" => "something")) # inside an Option instance