php根据变量的类型 自动识别echo或dump
Jun 13, 2016 am 10:14 AM有时我们要输出字符中的变量我们可能会用到dump_var但如果我们想自动输出,我们就需要算定函数了。
代码如下 | 复制代码 |
function show_var($var) { show_var($pi); show_var($proteins) |
描述
bool is_scalar ( mixed $var )
如果给出的变量参数 var 是一个标量, is_scalar() 返回 TRUE,否则返回 FALSE。
标量变量是指那些包含了 integer、float、string 或 boolean的变量,而 array、object 和 resource 则不是标量。
Note:
尽管当前的 resource 类型是居于整数的,但 is_scalar() 不会把它们当作是标量,因为资源是抽象数据类型。不能依赖于执行细节,因为它可能会改变。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
