var_dump

本文详细介绍了 PHP 中用于变量信息展示的 var_dump 函数,包括其语法、参数说明及返回值,通过示例展示了如何使用该函数查看数组、浮点数及布尔值等不同类型变量的结构与内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

var_dump

(PHP 4, PHP 5)

var_dump — Dumps information about a variable

 Description

void  var_dump (  mixed $expression [,  mixed $... ] )

This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure.

In PHP 5 all public, private and protected properties of objects will be returned in the output.

Tip

As with anything that outputsits result directly to the browser, the output-control functions can be used to capturethe output of this function, and save it in astring (for example).

 Parameters

expression

The variable you want to export.

 Return Values

No value is returned.

Examples

Example #1 var_dump() example

<?php
$a 
= array(12, array("a""b""c"));
var_dump($a);
?>

The above example will output:

array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  array(3) {
    [0]=>
    string(1) "a"
    [1]=>
    string(1) "b"
    [2]=>
    string(1) "c"
  }
}
<?php

$b 
3.1;
$c true;
var_dump($b$c);

?>

The above example will output:

float(3.1)
bool(true)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值