note 87256 modified in function.ftp-chdir by danbrown

From: Date: Wed, 11 Mar 2009 13:58:33 +0000
Subject: note 87256 modified in function.ftp-chdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151729@lists.php.net to get a copy of this message
Works like the other functions in this page's notes, but this one doesn't make use of a global FTP connection, so it takes parameters like the other functions in the extension <?php function ftp_directory_exists($ftp, $dir) { // Get the current working directory $origin = ftp_pwd($ftp); // Attempt to change directory, suppress errors if (@ftp_chdir($ftp, $dir)) { // If the directory exists, set back to origin ftp_chdir($ftp, $origin); return true; } // Directory does not exist return false; } ?> [NOTE BY danbrown AT php DOT net: As the contributor mentions, the original function was noted here by (h3 AT valleyfield DOT net) on 13-JUL-2007.] --was-- Works like the other functions in this page's notes, but this one doesn't make use of a global FTP connection, so it takes parameters like the other functions in the extension <?php function ftp_directory_exists($ftp, $dir) { // Get the current working directory $origin = ftp_pwd($ftp); // Attempt to change directory, suppress errors if (@ftp_chdir($ftp, $dir)) { // If the directory exists, set back to origin ftp_chdir($ftp, $origin); return true; } // Directory does not exist return false; } ?> http://php.net/manual/en/function.ftp-chdir.php

« previous php.notes (#151729) next »