Variable handling 函数
PHP 手册

is_binary

(PHP 6 >= 6.0.0)

is_binaryFinds whether a variable is a native binary string

说明

bool is_binary ( mixed $var )

Finds whether the given variable is a native binary string.

参数

var

The variable being evaluated.

返回值

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

范例

Example #1 is_binary() example

<?php
// Declare a unicode string
$unicode 'This is a unicode string';

// Declare a binary string using the 'b' prefix
// available as of PHP 5.2.1, but it will only have 
// effect as of PHP 6.0.0
$binary b'This is a binary string';

var_dump(is_binary($unicode), is_binary($binary));
?>

上例将输出:

bool(false)
bool(true)

参见


Variable handling 函数
PHP 手册