remove() static public method

Removes an element from an array
static public remove ( array $array, mixed $search, boolean $key = true ) : array
$array array The source array
$search mixed The value or key to look for
$key boolean Pass true to search for an key, pass false to search for an value.
return array The result array without the removed element
Exemplo n.º 1
0
 function remove($key)
 {
     return a::remove($_SESSION, $key);
 }
Exemplo n.º 2
0
 /**
  * Removes a value from the session by key
  *
  * @param  mixed    $key The key to remove by
  * @return array    The session array without the value
  */
 static function remove($key)
 {
     if (!isset($_SESSION)) {
         return false;
     }
     $_SESSION = a::remove($_SESSION, $key, true);
     return $_SESSION;
 }
Exemplo n.º 3
0
 function testArrayRemove()
 {
     $this->assertEqual(a::remove($this->arr, 'cat'), array('dog' => 'wuff', 'bird' => 'tweet'));
 }