What is the function used to create a folder on an FTP server in PHP?

To create a folder on an FTP server in PHP, you can use the `ftp_mkdir()` function. This function takes two parameters: the FTP connection resource and the name of the directory you want to create. Make sure to establish a connection to the FTP server before attempting to create a folder.

<?php
$ftp_server = 'ftp.example.com';
$ftp_user = 'username';
$ftp_pass = 'password';

// Connect to FTP server
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);

// Check if connection is successful
if ($conn_id && $login_result) {
    // Create a new directory
    $new_dir = 'new_folder';
    if (ftp_mkdir($conn_id, $new_dir)) {
        echo "Directory created successfully.";
    } else {
        echo "Failed to create directory.";
    }

    // Close FTP connection
    ftp_close($conn_id);
} else {
    echo "Failed to connect to FTP server.";
}
?>