From 1a0acb3b8aeb580ef74ab3399da8961c469029e5 Mon Sep 17 00:00:00 2001 From: sy-records <52o@qq52o.cn> Date: Sat, 25 Nov 2023 16:33:15 +0800 Subject: [PATCH] Sync var functions --- reference/var/functions/get-debug-type.xml | 209 ++++++++++++++++++++ reference/var/functions/get-resource-id.xml | 105 ++++++++++ reference/var/functions/is-countable.xml | 119 +++++++++++ 3 files changed, 433 insertions(+) create mode 100644 reference/var/functions/get-debug-type.xml create mode 100644 reference/var/functions/get-resource-id.xml create mode 100644 reference/var/functions/is-countable.xml diff --git a/reference/var/functions/get-debug-type.xml b/reference/var/functions/get-debug-type.xml new file mode 100644 index 000000000..442b36f33 --- /dev/null +++ b/reference/var/functions/get-debug-type.xml @@ -0,0 +1,209 @@ + + + + + + get_debug_type + 以适合调试的方式获取变量的类型名称 + + + + &reftitle.description; + + stringget_debug_type + mixedvalue + + + 会返回 PHP 变量 value 的类型名称。 + 该函数会将对象解析为其类名,资源解析为其资源类型名称,标量值解析为其常用名称,就像在类型声明中使用的那样。 + + + 该函数与 gettype 的区别在于:它返回的类型名称更符合实际用法,而不是那些出于历史原因而存在的名称。 + + + + + &reftitle.parameters; + + + + value + + + 要检查类型的变量。 + + + + + + + + + &reftitle.returnvalues; + + 返回的字符串可能有以下值: + + + + + + 类型 + 状态 + 返回值 + 备注 + + + + + null + + "null" + + - + + + Booleans (true or false) + + "bool" + + - + + + Integers + + "int" + + - + + + Floats + + "float" + + - + + + Strings + + "string" + + - + + + Arrays + + "array" + + - + + + Resources + + "resource (resourcename)" + + - + + + Resources (Closed) + + "resource (closed)" + + 例如:使用 fclose 关闭后的文件流 + + + Objects from Named Classes + + 类的全名,包括其命名空间,例如 Foo\Bar + + - + + + Objects from Anonymous Classes + + "class@anonymous" + + + 匿名类是通过 $x = new class { ... } 语法创建的类 + + + + + + + + + + + &reftitle.examples; + + + <function>get_debug_type</function> 示例 + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + gettype + get_class + + + + + diff --git a/reference/var/functions/get-resource-id.xml b/reference/var/functions/get-resource-id.xml new file mode 100644 index 000000000..2ad2b7e59 --- /dev/null +++ b/reference/var/functions/get-resource-id.xml @@ -0,0 +1,105 @@ + + + + + + get_resource_id + + 返回给定资源的整数标识符 + + + + + &reftitle.description; + + intget_resource_id + resourceresource + + + 此函数提供了一种类型安全的方式来生成资源的整数标识符。 + + + + + &reftitle.parameters; + + + + resource + + + 需要获取的资源句柄。 + + + + + + + + + &reftitle.returnvalues; + + 给定 resourceint 标识符。 + + + 此函数本质上是对 resourceint 转换,使得更容易获取资源的标识符。 + + + + + &reftitle.examples; + + + <function>get_resource_id</function> 与 <type>int</type> 转换的结果相同 + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + get_resource_type + + + + + diff --git a/reference/var/functions/is-countable.xml b/reference/var/functions/is-countable.xml new file mode 100644 index 000000000..49356e9da --- /dev/null +++ b/reference/var/functions/is-countable.xml @@ -0,0 +1,119 @@ + + + + + + is_countable + + 验证变量内容是否为可数值 + + + + + &reftitle.description; + + boolis_countable + mixedvalue + + + 验证变量的内容是数组还是实现了 Countable 接口的对象 + + + + + &reftitle.parameters; + + + + value + + + 需要检查的值 + + + + + + + + + &reftitle.returnvalues; + + 如果 value 是可数值,返回 &true;,否则返回 &false;。 + + + + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 7.3.0 + + is_countable 被添加。 + + + + + + + + + &reftitle.examples; + + + <function>is_countable</function> 示例 + + + + + + + + + &reftitle.seealso; + + + is_array + is_object + is_iterable + is_bool + + + + + +