original_string: public static function create_path(string $dir, $chmod=false){
      if ( !$dir || !\is_string($dir) ){
        return false;
      }
      clearstatcache();
      if ( !is_dir($dir) ){
        $bits = explode('/', $dir);
        $path = empty($bits[0]) ? '/' : '';
        foreach ( $bits as $i => $b ){
          if ( !empty($b) ){
            $path .= $b;
            if ( !is_dir($path) ){
              if ( !mkdir($path) || !is_dir($path) ){
                return false;
              }
              if ( $chmod ){
                @chmod($path, $chmod);
              }
            }
            $path .= '/';
          }
        }
      }
      return $dir;
  	}
code: public static function create_path(string $dir, $chmod=false){
      if ( !$dir || !\is_string($dir) ){
        return false;
      }
      clearstatcache();
      if ( !is_dir($dir) ){
        $bits = explode('/', $dir);
        $path = empty($bits[0]) ? '/' : '';
        foreach ( $bits as $i => $b ){
          if ( !empty($b) ){
            $path .= $b;
            if ( !is_dir($path) ){
              if ( !mkdir($path) || !is_dir($path) ){
                return false;
              }
              if ( $chmod ){
                @chmod($path, $chmod);
              }
            }
            $path .= '/';
          }
        }
      }
      return $dir;
  	}
code_tokens: public static function create_path ( string $ dir , $ chmod = false ) { if ( ! $ dir || ! \ is_string ( $ dir ) ) { return false ; } clearstatcache ( ) ; if ( ! is_dir ( $ dir ) ) { $ bits = explode ( '/' , $ dir ) ; $ path = empty ( $ bits [ 0 ] ) ? '/' : '' ; foreach ( $ bits as $ i => $ b ) { if ( ! empty ( $ b ) ) { $ path .= $ b ; if ( ! is_dir ( $ path ) ) { if ( ! mkdir ( $ path ) || ! is_dir ( $ path ) ) { return false ; } if ( $ chmod ) { @ chmod ( $ path , $ chmod ) ; } } $ path .= '/' ; } } } return $ dir ; }
docstring: Creates a folder with the given path.
  
  ```php
  \bbn\x::dump(\bbn\file\dir::create_path("/home/data/test/New"));
  \\ (string) "/home/data/test/New"
  ```
  
  @param string $dir The new directory's path.
  @param bool $chmod If set to true the user won't have the permissions to view the content of the folder created
  @return string|false
docstring_tokens: Creates a folder with the given path .