Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by karthikeya Boyini
Page 51 of 143
Check if a string starts with given word in PHP
In PHP, you can check if a string starts with a specific word or substring using various methods. The most common approaches include using substr(), strpos(), or the newer str_starts_with() function (PHP 8+). Using Custom Function with substr() Create a function that compares the beginning of a string with the specified substring ?
Read Moreftp_raw() function in PHP
The ftp_raw() function sends raw commands directly to the FTP server and returns the server's response. This gives you low-level control over FTP operations by allowing you to send any valid FTP protocol command. Syntax ftp_raw(connection, command) Parameters connection − The FTP connection resource created by ftp_connect() command − The raw FTP command to execute (without trailing CRLF) Return Value The ftp_raw() function returns the server's response as an array of strings, where each element represents a line of the server's response. Example The following example demonstrates sending ...
Read Moreftp_pasv() function in PHP
The ftp_pasv() function in PHP enables or disables passive mode for FTP connections. Passive mode allows the client to initiate data connections, which is often required when working behind firewalls or NAT routers. Syntax ftp_pasv(connection, pasv) Parameters connection − The FTP connection resource returned by ftp_connect() pasv − A boolean value that specifies the passive mode state − TRUE − Enable passive mode ...
Read Moreftp_nb_fput() function in PHP
The ftp_nb_fput() function uploads data from an open file pointer to a file on the FTP server using non-blocking mode. This allows your script to continue processing while the upload happens in the background. Syntax ftp_nb_fput(con, remote_file, open_file, transfer_mode, beg_pos); Parameters con − The FTP connection resource remote_file − The remote file path on the FTP server open_file − The file pointer resource opened with fopen() transfer_mode − The transfer mode. Possible values: − FTP_ASCII for text files − FTP_BINARY for binary files beg_pos − (Optional) The position to start uploading from ...
Read Moreftp_nb_continue() function in PHP
The ftp_nb_continue() function continues to receive or send a file to the FTP server in non-blocking mode. This function is used with non-blocking FTP operations to check the status and continue the transfer process. Syntax ftp_nb_continue($ftp_connection); Parameters ftp_connection − The FTP connection resource created by ftp_connect(). Return Value The ftp_nb_continue() function returns one of the following constants − FTP_FAILED − The transfer failed FTP_FINISHED − The transfer completed successfully FTP_MOREDATA − The transfer is still in progress Example The following example shows how to use ...
Read Moreftp_get_option() function in PHP
The ftp_get_option() function retrieves runtime configuration options for an established FTP connection, allowing you to check current settings like timeout values and autoseek behavior. Syntax ftp_get_option(connection, option); Parameters connection − The FTP connection resource returned by ftp_connect(). option − The runtime option to retrieve. Available constants: FTP_TIMEOUT_SEC − Returns the current network timeout in seconds FTP_AUTOSEEK − Returns TRUE if autoseek is enabled, FALSE otherwise Return Value Returns the option value on success, or FALSE if the specified option is not supported or the connection is invalid. ...
Read Moreftp_fget() function in PHP
The ftp_fget() function downloads a file from an FTP server and saves it directly into an open local file resource. This function is useful when you need to download files from a remote FTP server and store them locally. Syntax ftp_fget(con, open_file, server_file, mode, startpos); Parameters con − The FTP connection resource created by ftp_connect() open_file − An open file resource where the downloaded data will be stored server_file − The path to the file on the FTP server to download mode − The transfer mode (FTP_ASCII or FTP_BINARY) startpos − The position ...
Read Moreftp_close() function in PHP
The ftp_close() function in PHP is used to close an active FTP connection that was previously established using ftp_connect(). This function helps free up system resources and properly terminates the connection. Syntax ftp_close($connection); Parameters $connection − The FTP connection resource to close, returned by ftp_connect(). Return Value The ftp_close() function returns TRUE on success or FALSE on failure. Example The following example demonstrates connecting to an FTP server, performing directory operations, and properly closing the connection − Key Points Always close ...
Read Moreftp_alloc() function in PHP
The ftp_alloc() function allocates space for a file to be uploaded to the FTP server. This function is useful when uploading large files to ensure sufficient disk space is available on the server before attempting the transfer. Syntax ftp_alloc(connection, size_of_file, res); Parameters connection − The FTP connection resource to use size_of_file − The number of bytes to allocate on the server res − Optional variable to store the server response message Return Value The ftp_alloc() function returns TRUE on success or FALSE on failure. Example The following example ...
Read Moretan() function in PHP
The tan() function in PHP returns the tangent of a specified value in radians. It's a built-in mathematical function that calculates the ratio of sine to cosine for a given angle. Syntax tan(value) Parameters value − A numeric value representing an angle in radians (float or integer) Return Value The tan() function returns a float representing the tangent of the specified angle. Returns NaN for invalid inputs. Basic Examples Here are some basic examples demonstrating the tan() function ? 01.55740772465491 ...
Read More