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
Server Side Programming Articles
Page 1059 of 2109
ftp_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 Moreusleep() function in PHP
The usleep() function delays execution of the current script for a specified number of microseconds. It is useful for creating pauses in script execution or controlling timing in loops. Syntax usleep(microseconds) Parameters microseconds − The number of microseconds to delay the script. One second equals 1, 000, 000 microseconds. Return Value The usleep() function returns void (nothing). Example Here's how to use usleep() to create delays in script execution ? Output The output shows timestamps with delays between them ? ...
Read Moreuniqid() function in PHP
The uniqid() function generates a unique ID based on the current time in microseconds. It's commonly used for creating temporary filenames, session IDs, or unique identifiers where collision probability needs to be minimized. Syntax uniqid(prefix, more_entropy) Parameters prefix − Optional string to prefix the unique ID. Default is empty string. more_entropy − Optional boolean. If TRUE, adds additional entropy at the end for better uniqueness. Default is FALSE. Return Value The uniqid() function returns a unique identifier as a string, typically 13 characters long (23 characters when more_entropy is TRUE). ...
Read Moretime_nanosleep() function in PHP
The time_nanosleep() function delays execution of the current script for a specified number of seconds and nanoseconds. This function provides more precise timing control than sleep() by allowing nanosecond-level precision. Syntax time_nanosleep(sec, nsec) Parameters sec − The number of seconds to delay the script. nsec − The number of nanoseconds to delay the script (0 to 999, 999, 999). Return Value The time_nanosleep() function returns true on success, or false on failure. If the delay was interrupted by a signal, it returns an associative array with information about the remaining ...
Read Moresleep() function in PHP
The sleep() function delays execution of the current script for a specified number of seconds. This is useful for creating pauses in script execution, rate limiting, or simulating delays. Syntax sleep(seconds) Parameters seconds − The number of seconds to delay the script (integer value). Return Value The sleep() function returns zero on success, or FALSE on failure. Example Here's a simple example demonstrating how sleep() pauses script execution − Start time: 02:54:50 After 2 seconds: 02:54:52 After 3 more seconds: 02:54:55 ...
Read Moreshow_source() function in PHP
The show_source() function in PHP displays the source code of a PHP file with syntax highlighting. This function is useful for code documentation, debugging, or educational purposes where you need to display formatted PHP source code. Syntax show_source(file, return) Parameters file − The file name to display. This can be a relative or absolute path to the PHP file. return − Optional boolean parameter. If set to true, the function returns the highlighted code as a string instead of printing it. Default is false. Return Value If the return parameter ...
Read Morephp_strip_whitespace() function in PHP
The php_strip_whitespace() function returns PHP source code with stripped comments and whitespace, making it useful for code optimization and analysis. Syntax php_strip_whitespace(file_path) Parameters file_path − The path to the PHP file to be processed. Return Value The php_strip_whitespace() function returns the stripped source code as a string on success, or FALSE on failure. Example Let's create a sample PHP file and then use php_strip_whitespace() to process it ? Now, let's strip the whitespace and comments ? ...
Read Morepack() function in PHP
The pack() function in PHP converts data into a binary string according to a specified format. This function is useful for creating binary data structures, network protocols, or file formats that require specific byte arrangements. Syntax pack(format, args) Parameters format − The format string specifying how to pack the data. Common format codes include: a − NUL-padded string A − SPACE-padded string ...
Read Moreignore_user_abort() function in PHP
The ignore_user_abort() function sets whether a remote client can abort the running of a script. When enabled, the script continues executing even if the user closes their browser or navigates away from the page. Syntax ignore_user_abort(setting) Parameters setting − Optional boolean parameter. TRUE ignores user aborts (script continues running), FALSE allows user aborts to stop the script (default behavior). Return Value The ignore_user_abort() function returns the previous value of the user-abort setting as an integer (0 for false, 1 for true). Example 1: Getting Current Setting The following ...
Read Morehighlight_file() function in PHP
The highlight_file() function outputs a file with the PHP syntax highlighted using colors. It's useful for displaying PHP source code in a readable, formatted way on web pages. Syntax highlight_file(file, return) Parameters file − The file name to display. Can be a relative or absolute path to the PHP file. return − Optional boolean parameter. If set to true, the function returns the highlighted code as a string instead of printing it directly. Default is false. Return Value Returns true on success or false on failure when the return parameter ...
Read More