setArrayToDotNotation() public static method

To set value in array with dot notation
public static setArrayToDotNotation ( type &$root, type $dotNotationKeys, type $value )
$root type
$dotNotationKeys type
$value type
Example #1
0
 /**
  * Assign variable
  * @param  mixed          $key - can be string, dot notation k/v, or array to set data as bulk
  * @param  mixed          $val - can be string, numeric, array
  * @return Api
  */
 public function assign($key, $val = "")
 {
     if (is_string($key) || is_array($key)) {
         $data = array();
         if (is_string($key)) {
             if (preg_match("/\\./", $key)) {
                 // dot notation keys
                 Core\Helpers::setArrayToDotNotation($data, $key, $val);
             } else {
                 $data[$key] = $val;
             }
         } else {
             $data = $key;
         }
         $this->assigned = array_merge_recursive($data, $this->assigned);
         return $this;
     } else {
         throw new Core\Exception("Can't assign() {$key}. Invalid key type. Must be string or array");
     }
 }