Skip to content
Snippets Groups Projects
Commit 3ee64725 authored by Laurent's avatar Laurent
Browse files

hotline #28822 search_speed

fix array_column compatibility with PHP5.4
parent 95f44946
Branches
Tags
2 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1065Hotline#28822 search speed
......@@ -16,9 +16,17 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// helpers sur les arrays
// compatibility with PHP < 5.5
if(!function_exists("array_column")) {
function array_column($array, $column_name) {
return array_map(function($element) use($column_name){return $element[$column_name];}, $array);
}
}
function array_first(array $array) {
$values = array_values($array);
......@@ -27,7 +35,7 @@ function array_first(array $array) {
function array_last(array $array) {
if (0 == $count = count($array))
if (0 == $count = count($array))
return null;
$values = array_values($array);
return $values[$count - 1];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment