Current Location: Home> Function Categories> print_r

print_r

Print variables in an easy to understand format
Name:print_r
Category:Variable processing
Programming Language:php
One-line Description:Print information about variables in a human-readable way.

Definition and usage

print_r() function prints information about variables in a more readable way.

Example

Print information about some variables in a more readable way:

 <?php
$a = array ( "red" , "green" , "blue" ) ;
print_r ( $a ) ;

echo "<br>" ;

$b = array ( "Peter" => "35" , "Ben" => "37" , "Joe" => "43" ) ;
print_r ( $b ) ;
?>

Try it yourself

grammar

 print_r ( variable , return ) ;
parameter describe
variable Required. Specifies the variable to return information.
Return

Optional. When set to true, the function returns information (rather than printing it).

Default is false.

Similar Functions
Popular Articles