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']); }
/** * 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); }