示例#1
0
 function test_pull()
 {
     $data = array('developer1' => 'Tonya', 'developer2' => 'Julie');
     $this->assertEquals('Julie', Arr::pull($data, 'developer2'));
     $this->assertEquals(array('developer1' => 'Tonya'), $data);
     $this->assertEquals('Tonya', wpdevsclub_array_pull($data, 'developer1'));
     $this->assertEquals(array(), $data);
 }
示例#2
0
 /**
  * Get a value from the array, and remove it.
  *
  * @param  array   $array
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  */
 function wpdevsclub_array_pull(&$array, $key, $default = null)
 {
     return Arr::pull($array, $key, $default);
 }