예제 #1
0
 function test_set()
 {
     $array = array();
     Arr::set($array, 'names.developer', 'Tonya');
     $this->assertEquals('Tonya', $array['names']['developer']);
     wpdevsclub_array_set($array, 'names.developer', 'Julie');
     $this->assertEquals('Julie', $array['names']['developer']);
 }
예제 #2
0
 /**
  * Set an array item to a given value using "dot" notation.
  *
  * If no key is given to the method, the entire array will be replaced.
  *
  * @param  array   $array
  * @param  string  $key
  * @param  mixed   $value
  * @return array
  */
 function wpdevsclub_array_set(&$array, $key, $value)
 {
     return Arr::set($array, $key, $value);
 }