source: OWR/Arrays.php @ 4ade32

Revision 4ade32, 1.7 KB checked in by pierre-alain <pierre-alain@…>, 6 years ago (diff)

Optimize joins in sql queries

  • Property mode set to 100644
Line 
1<?php
2/**
3 * Arrays class
4 * This class is usefull to manipulate arrays
5 *
6 * PHP 5
7 *
8 * OWR - OpenWebReader
9 *
10 * Copyright (c) 2009, Pierre-Alain Mignot
11 *
12 * Home page: http://openwebreader.org
13 *
14 * E-Mail: contact@openwebreader.org
15 *
16 * All Rights Reserved
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * @author Pierre-Alain Mignot <contact@openwebreader.org>
33 * @copyright Copyright (c) 2009, Pierre-Alain Mignot
34 * @license http://www.gnu.org/copyleft/gpl.html
35 * @package OWR
36 */
37namespace OWR;
38/**
39 * This object is used to manipulate arrays
40 * @package OWR
41 */
42class Arrays
43{
44    /**
45     * Transforms multi-dimensional array to indexed array
46     *
47     * @author Pierre-Alain Mignot <contact@openwebreader.org>
48     * @access public
49     * @static
50     * @param array $array the multi-dimensional array to transform
51     * @return array indexed $array
52     */
53    static public function multiDimtoNumericalArray(array $array)
54    {
55        $arr = array();
56        foreach(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array)) as $v)
57            $arr[] = $v;
58
59        return $arr;
60    }
61}
Note: See TracBrowser for help on using the repository browser.