public static function randArray(array $array, $param = array())
    {
        if (!is_array($param)) {
            $param = json_decode($param, true);
        }

        $defParam = array();

        $param = Arr::merge($defParam, $param);

        # Define the number of element to take
        if (!empty($param['take'])) {
            $response = array();

            for ($i = 1; $i <= $param['take']; $i++) {
                $response []= $array[array_rand($array, 1)];
            }

            return $response;
        } else {
            # Return randomly only 1 element value of the array
            return $array[array_rand($array, 1)];
        }
    }
public static function randArray(array $array, $param = array())
    {
        if (!is_array($param)) {
            $param = json_decode($param, true);
        }

        $defParam = array();

        $param = Arr::merge($defParam, $param);

        # Define the number of element to take
        if (!empty($param['take'])) {
            $response = array();

            for ($i = 1; $i <= $param['take']; $i++) {
                $response []= $array[array_rand($array, 1)];
            }

            return $response;
        } else {
            # Return randomly only 1 element value of the array
            return $array[array_rand($array, 1)];
        }
    }
public static function randArray ( array $ array , $ param = array ( ) ) { if ( ! is_array ( $ param ) ) { $ param = json_decode ( $ param , true ) ; } $ defParam = array ( ) ; $ param = Arr :: merge ( $ defParam , $ param ) ; # Define the number of element to take if ( ! empty ( $ param [ 'take' ] ) ) { $ response = array ( ) ; for ( $ i = 1 ; $ i <= $ param [ 'take' ] ; $ i ++ ) { $ response [ ] = $ array [ array_rand ( $ array , 1 ) ] ; } return $ response ; } else { # Return randomly only 1 element value of the array return $ array [ array_rand ( $ array , 1 ) ] ; } }
Random an array

@param array $array
@param array $param
@return string
Random an array