downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

is_callable> <is_bool
Last updated: Fri, 04 Dec 2009

view this page in

is_buffer

(PHP 6 >= 6.0.0)

is_bufferFinds whether a variable is a native unicode or binary string

Description

bool is_buffer ( mixed $var )

Finds whether the given variable is a native unicode or binary string.

Parameters

var

The variable being evaluated.

Return Values

Returns TRUE if var is a native unicode or binary string, FALSE otherwise.

Examples

Example #1 is_buffer() example

<?php
// Declare some variables with different types
$types = array(
            
'unicode'    => 'Unicode string'
            
'binary'    => b'Binary string'
            
'resource'    => fopen('php://stdin''r'), 
            
'integer'    => 42
            
);

// Test which types thats a buffer
foreach($types as $type => $value)
{
    if(
is_buffer($value))
    {
        echo 
$type ' is a either a unicode or binary string';
    }
    else
    {
        echo 
$type ' is not a buffer value';
    }

    echo 
PHP_EOL;
}
?>

The above example will output:

unicode is a either a unicode or binary string
binary is a either a unicode or binary string
resource is not a buffer value
integer is not a buffer value

See Also

  • is_binary() - Finds whether a variable is a native binary string
  • is_string() - Find whether the type of a variable is string
  • is_unicode() - Finds whether a variable is a unicode string



add a note add a note User Contributed Notes
is_buffer
There are no user contributed notes for this page.

is_callable> <is_bool
Last updated: Fri, 04 Dec 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites