Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Does ! work as an operator to check whether handles are null or not, especially file handles ?

Does ! work as an operator to check whether handles are null or not, especially file handles ?

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
phpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    parth_patel
    wrote on last edited by
    #1

    Check this code. Should it work in php?

    $handle = opendir($SourceURL);
    if ( !$handle )
    {
    closedir($handle);
    return FALSE;
    }
    /// Doing some work with $handle

    Thanks, Parth

    R F 2 Replies Last reply
    0
    • P parth_patel

      Check this code. Should it work in php?

      $handle = opendir($SourceURL);
      if ( !$handle )
      {
      closedir($handle);
      return FALSE;
      }
      /// Doing some work with $handle

      Thanks, Parth

      R Offline
      R Offline
      Reptar0
      wrote on last edited by
      #2

      This suggestion sounds silly but Im posting it anyway. Dont you want an If/Else control instead of just an If. And also can you be more specific on whats going wrong?

      1 Reply Last reply
      0
      • P parth_patel

        Check this code. Should it work in php?

        $handle = opendir($SourceURL);
        if ( !$handle )
        {
        closedir($handle);
        return FALSE;
        }
        /// Doing some work with $handle

        Thanks, Parth

        F Offline
        F Offline
        fly904
        wrote on last edited by
        #3

        This was in the PHP documentation[^].

        if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
        ...
        closedir($dh);
        }
        }

        If at first you don't succeed, you're not Chuck Norris.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups