コード例 #1
0
ファイル: test-arr.php プロジェクト: iCaspar/WPDC_Core
 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
ファイル: arr-helpers.php プロジェクト: iCaspar/WPDC_Core
 /**
  * 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);
 }