PHP print_r() function
The print_r() function is used to print variables and display them in a more understandable form.
##PHP version requirements: PHP 4, PHP 5, PHP 7
Syntax
bool print_r ( mixed $expression [, bool $return ] )
Parameter description: (Recommended learning: PHP video tutorial)
$expression: the variable to be printed, if string is given, For integer or float type variables, the variable value itself will be printed. If an array is given, the keys and elements will be displayed in a certain format. object is similar to an array. $return: Optional, if true, the result will not be output, but the result will be assigned to a variable, if false, the result will be output directly.Return value
$return If set to true, there will be a return value, which is an easy-to-understand string information. Example<?php $a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x','y','z')); print_r ($a); ?>
Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ) )
The above is the detailed content of What does print_r mean in php?. For more information, please follow other related articles on the PHP Chinese website!