PHP var_dump() Function Last Updated : 30 Sep, 2024 Comments Improve Suggest changes Like Article Like Report The var_dump() function in PHP is used to display structured information about one or more variables. The structured information means type and value of the given variable. It outputs not just the value of the variable but also its data type and, in the case of arrays or objects, all of their structure.Syntaxvar_dump(mixed $value, mixed ...$values): voidParameters$value: The variable or value to be dumped.$values: Additional variables to dump (optional).Return ValueThis function does not return any value. It outputs the result directly to the browser or console. Example 1: Basic example of var_dump() function. PHP <?php $number = 123; $string = "Hello, World!"; $array = [1, 2, 3, "PHP", true]; var_dump($number); var_dump($string); var_dump($array); ?> Outputint(123) string(13) "Hello, World!" array(5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> string(3) "PHP" [4]=> bool(true) } Example 2: The use of var_dump() function on objects. PHP <?php class Test { public $name = "PHP"; public $version = 8; } $obj = new Test(); var_dump($obj); ?> Outputobject(Test)#1 (2) { ["name"]=> string(3) "PHP" ["version"]=> int(8) } Example 3: The use of var_dump() function in nested array. PHP <?php $nestedArr = [ "languages" => ["PHP", "JavaScript", "Python"], "frameworks" => ["Laravel", "React", "Django"] ]; var_dump($nestedArr); ?> Outputarray(2) { ["languages"]=> array(3) { [0]=> string(3) "PHP" [1]=> string(10) "JavaScript" [2]=> string(6) "Python" } ["frameworks"]=> array(3) { [0]=> string(7) "Laravel" [1]=> string(5) "React" [2]=> string(6) "Django" } } Comment More infoAdvertise with us Next Article PHP var_dump() Function P PronabM Follow Improve Article Tags : Misc Web Technologies PHP PHP-basics PHP-function +1 More Practice Tags : Misc Similar Reads PHP debug_zval_dump() Function The debug_zval_dump() is an inbuilt function in PHP where the string representation of an internal zval structure will be dumped to the output. Syntax: debug_zval_dump(mixed $value, mixed ...$values): voidParameters: This function has two parameters: value: This parameter specifies the variable or v 1 min read PHP | var_export() Function The var_export() is a built-in function in PHP which is used to return the structured value(information) of a variable that is passed to this function as a parameter. This function is similar to the var_dump() function.Syntax: var_export($var, $return) Parameters: This function accepts two parameter 1 min read PHP strval() Function The PHP strval() function converts a given variable to a string. It takes a scalar variable (like integers, floats, and booleans) and converts it to its string representation. For arrays, objects, and resources, it does not work and may produce unexpected results.Syntaxstrval( $variable ) Parameter: 3 min read PHP trim() Function The trim() function in PHP is an inbuilt function which removes whitespaces and also the predefined characters from both sides of a string that is left and right. Related Functions: PHP | ltrim() Function PHP | rtrim() Function Syntax: trim($string, $charlist) Parameters:The function accepts one man 2 min read PHP compact() Function The compact() function is an inbuilt function in PHP and it is used to create an array using variables. This function is the opposite of the extract() function. It creates an associative array whose keys are variable names and their corresponding values are array values. Syntax: array compact("varia 2 min read PHP | get_defined_vars() Function The get_defined_vars() function is an inbuilt function in PHP which is used to returns an array of all defined variables. This function returns a multidimensional array which contains all the list of variables, environment etc. Syntax: array get_defined_vars( void ) Parameters: This function does no 1 min read PHP | ob_start() Function Let's take a quick recap. PHP is an interpreted language thus each statement is executed one after another, therefore PHP tends to send HTML to browsers in chunks thus reducing performance. Using output buffering the generated HTML gets stored in a buffer or a string variable and is sent to the buff 2 min read PHP vfprintf() Function The vfprintf() function is an inbuilt function in PHP that is used to write formatted information to a stream, such as a file or the output screen. Syntax: vfprintf(resource $stream, string $format, array $values): Parameters: This function accepts three parameters that are described below. $stream: 2 min read PHP | unpack() Function The unpack() function is an inbuilt function in PHP which is used to unpack from a binary string into the respective format. Syntax: array unpack( $format, $data, $offset ) Parameters: This function accepts three parameters as mentioned above and described below: $format: It is required parameter. I 3 min read PHP String Functions Strings are a fundamental data type in PHP, used to store and manipulate text. PHP provides a wide variety of built-in string functions. These functions perform various operations such as string transformations, character manipulations, encoding and decoding, and formatting, making string handling s 6 min read Like