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

search for in the

debug_zval_dump> <変数操作
Last updated: Fri, 10 Oct 2008

view this page in

変数操作 関数

目次

  • debug_zval_dump — 内部的な Zend の値を表す文字列をダンプする
  • doubleval — floatval のエイリアス
  • empty — 変数が空であるかどうかを検査する
  • floatval — 変数の float 値を取得する
  • get_defined_vars — 全ての定義済の変数を配列で返す
  • get_resource_type — リソース型を返す
  • gettype — 変数の型を取得する
  • import_request_variables — GET/POST/Cookie 変数をグローバルスコープにインポートする
  • intval — 変数の整数としての値を取得する
  • is_array — 変数が配列かどうかを検査する
  • is_binary — 変数がネイティブバイナリ文字列かどうかを調べる
  • is_bool — 変数が boolean であるかを調べる
  • is_buffer — 変数がネイティブ unicode あるいはバイナリ文字列かどうかを調べる
  • is_callable — 引数が、関数としてコール可能な構造であるかどうかを調べる
  • is_double — is_float のエイリアス
  • is_float — 変数の型が float かどうか調べる
  • is_int — 変数が整数型かどうかを検査する
  • is_integer — is_int のエイリアス
  • is_long — is_int のエイリアス
  • is_null — 変数が NULL かどうか調べる
  • is_numeric — 変数が数字または数値形式の文字列であるかを調べる
  • is_object — 変数がオブジェクトかどうかを検査する
  • is_real — is_float のエイリアス
  • is_resource — 変数がリソースかどうかを調べる
  • is_scalar — 変数がスカラかどうかを調べる
  • is_string — 変数の型が文字列かどうかを調べる
  • is_unicode — 変数が unicode 文字列かどうかを調べる
  • isset — 変数がセットされているかどうかを検査する
  • print_r — 指定した変数に関する情報を解りやすく出力する
  • serialize — 値の保存可能な表現を生成する
  • settype — 変数の型をセットする
  • strval — 変数の文字列としての値を得ます
  • unserialize — 保存用表現から PHP の値を生成する
  • unset — 指定した変数の割当を解除する
  • var_dump — 変数に関する情報をダンプする
  • var_export — 変数の文字列表現を出力または返す


add a note add a note User Contributed Notes
変数操作 関数
jfrasca at sheerdev dot com
31-Aug-2005 11:27
I needed a simple function that would reduce any kind of variable to a string or number while retaining some semblance of the data that was stored in the variable. This is what I came up with:

<?
function ReduceVar ($Value) {
    switch (
gettype($Value)) {
        case
"boolean":
        case
"integer":
        case
"double":
        case
"string":
        case
"NULL":
            return
$Value;
        case
"resource":
            return
get_resource_type($Value);
        case
"object":
            return
ReduceVar(get_object_vars($Value));
        case
"array":
            if (
count($Value) <= 0)
                return
NULL;
            else
                return
ReduceVar(reset($Value));
        default:
            return
NULL;
    }
}
?>
skelley at diff dot nl
22-Sep-2001 05:55
Sorry to say Mykolas, but your definition would not be correct.

isempty() evaluates to true for NULL, 0, "", false or 'not set' for any variable, object etc. that can be set to a value.

isset() evaluates to true if the variable, object etc. exists at all, whether it is 'empty' or not.

Example:
$foo = 0;
isset($foo); //will evaluate to true.
!empty($foo); //will evaluate to false.

unset($foo);
isset($foo); //will evaluate to false.
!empty($foo); //will evaluate to false.

debug_zval_dump> <変数操作
Last updated: Fri, 10 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites