array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.ftp-pwd.php', 1 => 'ftp_pwd', 2 => 'Returns the current directory name', ), 'up' => array ( 0 => 'ref.ftp.php', 1 => 'FTP Functions', ), 'prev' => array ( 0 => 'function.ftp-put.php', 1 => 'ftp_put', ), 'next' => array ( 0 => 'function.ftp-quit.php', 1 => 'ftp_quit', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ftp/functions/ftp-pwd.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ftp_pwd

(PHP 4, PHP 5, PHP 7, PHP 8)

ftp_pwdReturns the current directory name

Description

ftp_pwd(FTP\Connection $ftp): string|false

Parameters

ftp

An FTP\Connection instance.

Return Values

Returns the current directory name or false on error.

Changelog

Version Description
8.1.0 The ftp parameter expects an FTP\Connection instance now; previously, a resource was expected.

Examples

Example #1 ftp_pwd() example

<?php

// set up basic connection
$ftp = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);

// change directory to public_html
ftp_chdir($ftp, 'public_html');

// print current directory
echo ftp_pwd($ftp); // /public_html

// close the connection
ftp_close($ftp);
?>

See Also