public static function try_directory($file)
    {
      $matches = array();
      preg_match("/(.*\/).*$/", $file, $matches);
      
      try {
        if (sizeof($matches) >= 1) {
          $folder = $matches[1];

          if (!(is_dir($folder))) {
            mkdir($folder);
            return 1;
          }
        }
      } catch (Exception $e) {
        /** do not handle this exception it is low level and will be warned by the caller **/

        return -1;
      }

      return 1;
    }
public static function try_directory($file)
    {
      $matches = array();
      preg_match("/(.*\/).*$/", $file, $matches);
      
      try {
        if (sizeof($matches) >= 1) {
          $folder = $matches[1];

          if (!(is_dir($folder))) {
            mkdir($folder);
            return 1;
          }
        }
      } catch (Exception $e) {
        /** do not handle this exception it is low level and will be warned by the caller **/

        return -1;
      }

      return 1;
    }
public static function try_directory ( $ file ) { $ matches = array ( ) ; preg_match ( "/(.*\/).*$/" , $ file , $ matches ) ; try { if ( sizeof ( $ matches ) >= 1 ) { $ folder = $ matches [ 1 ] ; if ( ! ( is_dir ( $ folder ) ) ) { mkdir ( $ folder ) ; return 1 ; } } } catch ( Exception $ e ) { /** do not handle this exception it is low level and will be warned by the caller **/ return - 1 ; } return 1 ; }
make a directory
if needed
@param fully qualified path
make a directory if needed