Location: PHPKode > projects > PWF > PWF_0.3.0/Array.php
<?php
/**
 * _Array provides static methods that are utilities to arrays 
 * @copyright	Copyright (c) 2012, PWF
 * @license		http://phpwebframework.com/License 
 * @version PWF_0.3.0
 */
class _Array
{

  /**
   * Returns if the array contains the value given
   * @param array $array
   * @param $value 
   * @return boolean
   */
  public static function containsValue($array,$value)
  {
    return in_array($value, $array);
  }

  /**
   * Returns if the array contains the key given
   * @param array $array
   * @param $key
   */
  public static function containsKey($array,$key)
  {
    return isset($array[$key]);
  }

  /**
   * Returns the size of the array 
   * @param array $array
   * @return number
   */
  public static function size($array)
  {
    return count($array);
  }

  /**
   * Joins the values of an array to string with the glue given
   * @param array $array
   * @param string $glue
   * @return string
   */
  public static function joinValues($array,$glue = "")
  {
    return implode($glue, $array);
  }

  /**
   * Reverses the order of array elements  
   * @param array $array
   * @return array
   */
  public static function reverse($array)
  {
    return array_reverse($array);
  }

  /**
   * Removes the last element from an array 
   * <b>Notice:</b> This function don't return a new array but do the action to the one given 
   * @param $array
   */
  public static function removeLastElement(&$array)
  {
    array_pop($array);
  }

  /**
   * Returns if the given is a valid array
   * @param array $array
   * @return boolean
   */
  public static function isValid($array)
  {
    return is_array($array);
  }

}
?>
Return current item: PWF