original_string: public static function set(array &$array, string $path, $value)
      {
          // Get segments from path
          $segments = explode('.', $path);
  
          // Loop through segments
          while (count($segments) > 1) {
              $segment = array_shift($segments);
              if (!isset($array[$segment]) || !is_array($array[$segment])) {
                  $array[$segment] = [];
              }
              $array =& $array[$segment];
          }
          $array[array_shift($segments)] = $value;
      }
code: public static function set(array &$array, string $path, $value)
      {
          // Get segments from path
          $segments = explode('.', $path);
  
          // Loop through segments
          while (count($segments) > 1) {
              $segment = array_shift($segments);
              if (!isset($array[$segment]) || !is_array($array[$segment])) {
                  $array[$segment] = [];
              }
              $array =& $array[$segment];
          }
          $array[array_shift($segments)] = $value;
      }
code_tokens: public static function set ( array & $ array , string $ path , $ value ) { // Get segments from path $ segments = explode ( '.' , $ path ) ; // Loop through segments while ( count ( $ segments ) > 1 ) { $ segment = array_shift ( $ segments ) ; if ( ! isset ( $ array [ $ segment ] ) || ! is_array ( $ array [ $ segment ] ) ) { $ array [ $ segment ] = [ ] ; } $ array = & $ array [ $ segment ] ; } $ array [ array_shift ( $ segments ) ] = $ value ; }
docstring: Sets an array value using "dot notation".
  
  Arr::set($array, 'foo.bar', 'value');
  
  @access  public
  @param   array    $array  Array you want to modify
  @param   string   $path   Array path
  @param   mixed    $value  Value to set
docstring_tokens: Sets an array value using dot notation .