PHP var_dump()

📔 : PHP 🔗

var_dump() function variable(s) के structure / information के बारे में बताता है। यह function variable में stored value उसका type , length etc. बताता है।


Array & Objects की property / values को यह function उनके structure के according show करता है। means अगर Array multidimensional है या Object किसी दुसरे Object को as a property contain करता है , var_dump() function उसे recursively show करता है।


PHP में यह काफी useful function है।

PHP var_dump Syntax

var_dump ( mixed $value , mixed ...$values );

  1. mixed $value | required : variable जिसके बारे में आपको information चाहिए।

  2. mixed ...$vars | optional : आप एक साथ कई variables check कर सकते हैं। हालाँकि कम से काम एक variable mandatory होता है।

PHP var_dump Example

File : php_var_dump.php

Copy Fullscreen Close Fullscreen
<?php 
  $a = array("Rahul Kumar", true , 0 , '', array(null, 'OK') );
  var_dump($a);
?>
Output
array(5) {
  [0]=>
  string(11) "Rahul Kumar"
  [1]=>
  bool(true)
  [2]=>
  int(0)
  [3]=>
  string(0) ""
  [4]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    string(2) "OK"
  }
} 

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook