php自主常用函数
来源:互联网 发布:rhel7关闭linux防火墙 编辑:程序博客网 时间:2024/05/17 01:59
/** * Returns the values of a specified column in an array. * The input array should be multidimensional or an array of objects. * * For example, * * ```php * $array = [ * ['id' => '123', 'data' => 'abc'], * ['id' => '345', 'data' => 'def'], * ]; * $result = ArrayHelper::getColumn($array, 'id'); * // the result is: ['123', '345'] * * // using anonymous function * $result = ArrayHelper::getColumn($array, function ($element) { * return $element['id']; * }); * ``` * * @param array $array * @param string|\Closure $name * @param bool $keepKeys whether to maintain the array keys. If false, the resulting array * will be re-indexed with integers. * @return array the list of column values */public static function getColumn($array, $name, $keepKeys = true){ $result = []; if ($keepKeys) { foreach ($array as $k => $element) { $result[$k] = static::getValue($element, $name); } } else { foreach ($array as $element) { $result[] = static::getValue($element, $name); } } return $result;}
阅读全文
0 0
- php自主常用函数
- 【php】php中常用函数
- 【PHP】php常用函数一览
- [PHP] 常用php函数汇总
- php常用函数
- php常用函数总结
- php常用函数
- php常用函数
- PHP常用函数
- 收藏PHP常用函数
- php常用函数
- 收藏PHP常用函数
- 常用PHP函数收集
- PHP常用函数
- php常用函数
- php常用函数
- 常用PHP函数
- php常用函数1
- 关于 ‘--exec’ 参数( find 命令)及介绍 ‘xargs ’命令区别
- c学习笔记3
- 查看树莓派3 WiFi连接速度
- CXF系列(四):CXF整合spring
- 转载 在ARM+Linux上移植NTP详解
- php自主常用函数
- poj3461KMP匹配
- eclipse 开发过程中经常出现一些UI的问题弹框
- mui 设置沉浸式导航
- Hadoop启动的时候,发现Datanode启动不了,解决办法
- 高通Camera整体框架
- Android动画由浅到深(一)
- CXF系列(五):soap与rest的比较
- 信用小白网贷难,如何提高网贷通过率?