PHP finfo_buffer() Function
Last Updated :
28 Feb, 2023
The finfo_buffer() is an inbuilt function in PHP that returns information about a string buffer.
Syntax:
- Procedural Style:
string | false finfo_uffer(
string $string,
int $flags = FILEINFO_NONE,
?resource $context = null
)
- Object-Oriented Style:
public finfo::buffer(
string $string,
int $flags = FILEINFO_NONE,
?resource $context = null
): string | false
Parameters: This function accepts three parameters that are described below:
- string: It contains the content of a file that to be checked.
- flags: It contains one or disjunction of more Fileinfo constants.
- finfo: It contains a finfo instance that is returned by finfo_open() function.
Return Value: This function returns a textual description of the string argument, otherwise, it will return false.
Example 1: This example describes the finfo_buffer() function.
PHP
<?php
$finfo = new finfo(FILEINFO_MIME);
echo $finfo ->buffer( "./index.php" ) . "\n" ;
?>
|
Output:
text/plain; charset=us-ascii
Example 2: This example describes the finfo_buffer() function.
PHP
<?php
$finfo = new finfo(FILEINFO_MIME);
echo finfo_buffer( $finfo , "./index.php" ) . "\n" ;
?>
|
Output:
text/plain; charset=us-ascii
Reference: https://www.php.net/manual/en/function.finfo-buffer.php
Share your thoughts in the comments
Please Login to comment...