【文件属性】:
文件名称:hooray:用于减少嵌套的 PHP 数组助手
文件大小:9KB
文件格式:ZIP
更新时间:2021-07-07 13:13:49
PHP
万岁
用于减少嵌套的 PHP 数组助手
这是第一次通过,出于某种我没有想到的原因,这可能很可怕。 随便...
在 PHP 中处理数组时,您可能做过或没有做过类似这个人为设计的可怕示例:
<?php
$ a = array ( 0 , 1 , 2 , 3 , 3 , 4 , 4 , 6 , 5 );
array_map ( function ( $ val ) {
return $ val * 10 ;
}, array_unique ( array_filter ( $ a ) ) );
print_r ( $ a );
?>
我对万岁的目标是让所有普通的数组函数都可以链接,这样更容易将它们分开,并且在某种程度上避免重复自己。
这是使用万岁的上述示例的等价物:
<?php
// constructor takes the array you want to work
【文件预览】:
hooray-master
----.gitignore(18B)
----README.md(2KB)
----hooray.class.php(3KB)
----LICENSE(18KB)
----hooray-test.php(447B)