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
Articles by karthikeya Boyini
Page 2 of 143
zip_read() function in PHP
The zip_read() function reads the next entry in a ZIP file archive. It iterates through entries sequentially, returning a resource for each file or directory found within the archive. Syntax zip_read(zip) Parameters zip − The zip resource to read, opened with zip_open() Return Value The zip_read() function returns a resource containing a file within the zip archive on success, or FALSE when there are no more entries to read. Example The following example demonstrates reading entries from a ZIP file. We have a zip file "new.zip" with the ...
Read Morezip_entry_read() function in PHP
The zip_entry_read() function is used to get the contents from an open zip archive file entry in PHP. Syntax zip_entry_read(zip_entry, len) Parameters zip_entry − The zip entry resource. Required. len − The length in bytes to read. Optional, defaults to 1024. Return Value Returns the contents from an open zip archive file entry as a string. Returns FALSE on failure. Example Let's say we have a zip file "one.zip" containing a single file "detail.txt" with the following content − Asia is a continent! Here's ...
Read Morezip_entry_name() function in PHP
The zip_entry_name() function returns the name of a directory entry inside a ZIP archive. This function is part of PHP's ZIP extension and works with ZIP archives opened using zip_open(). Syntax zip_entry_name(zip_entry) Parameters zip_entry − A directory entry resource from a ZIP file, obtained using zip_read() on an archive opened with zip_open(). Return Value The zip_entry_name() function returns the name of the ZIP archive entry as a string on success, or FALSE on failure. Example The following example demonstrates how to list all file names in a ZIP ...
Read Morezip_entry_close() function in PHP
The zip_entry_close() function is used to close a zip archive entry that was previously opened by the zip_entry_open() function. This function is part of PHP's Zip File Functions extension. Syntax zip_entry_close(zip_entry) Parameters zip_entry − The zip entry resource that was opened using zip_entry_open(). Required. Return Value The zip_entry_close() function returns TRUE on success and FALSE on failure. Example The following example demonstrates how to use zip_entry_close() to properly close a zip entry after reading it ? filename.txt closed successfully! Key ...
Read Moresin() function in PHP
The sin() function in PHP returns the sine of a number. It accepts a numeric value in radians and returns the corresponding sine value as a floating-point number. Syntax sin(number) Parameters number − A numeric value in radians for which you want to calculate the sine. Return Value The sin() function returns the sine of the given number as a float. The return value ranges between -1 and 1. Example 1 Here's a basic example demonstrating the sin() function with different radian values − ...
Read Morepow() function in PHP
The pow() function in PHP calculates the power of a number by raising the base to the specified exponent. It handles positive, negative, and floating-point values. Syntax pow(base, exponent) Parameters base − The base number (can be integer or float) exponent − The exponent to raise the base to (can be integer or float) Return Value Returns the result of base raised to the power of exponent. Returns NAN for invalid operations like negative base with fractional exponent. Example 1: Basic Power Calculation Calculate 3 raised to the ...
Read Moreoctdec() function in PHP
The octdec() function converts an octal number to its decimal equivalent. This function is useful when working with octal representations in PHP. Syntax octdec(octal_string) Parameters octal_string − A string containing the octal number to convert. Can include negative sign for negative numbers. Return Value The octdec() function returns the decimal equivalent of the specified octal number as an integer. Example 1: Basic Octal to Decimal Conversion Here's how to convert a simple octal number to decimal − 80 120 Example ...
Read Moremin() function in PHP
The min() function in PHP returns the minimum value from a given set of values or an array. It compares all provided values and returns the smallest one. Syntax min(arr_values); or min(val1, val2, ...); Parameters arr_values − An array containing the values to compare. val1, val2, ... − Individual values to compare (can pass multiple arguments). Return Value Returns the minimum value from the provided arguments or array. The return type matches the type of the smallest value. Example 1: Using ...
Read Morelog1p() function in PHP
The log1p() function in PHP returns log(1+number), computed in a way that is accurate even when the value of number is close to zero. This function is particularly useful for mathematical calculations involving logarithms of values near zero, where direct calculation of log(1+x) might lose precision. Syntax log1p(number) Parameters number − The numeric value to be processed. Must be greater than -1. Return Value Returns the natural logarithm of (1 + number) as a float. If the number is less than or equal to -1, the function returns NAN (Not ...
Read Morelog() function in PHP
The log() function in PHP calculates the natural logarithm (base e) of a number. It can also calculate logarithms with a specified base when provided as the second parameter. Syntax log(number, base) Parameters number − The value for which you want to calculate the logarithm (must be positive) base − Optional. The logarithmic base. If omitted, calculates natural logarithm (base e) Return Value Returns the logarithm of the number. Returns -INF for zero, NAN for negative numbers, and a float value for positive numbers. Examples Basic Natural Logarithm ...
Read More