PHP print_r() Function

P
PHP serialize() Function
PHP isset() Function

In this article, you will learn how to get the information about a variable in PHP. The PHP print_r() function prints the information about a variable in a more human-readable way.

what is the syntax of the PRINT_R() function in php?

print_r(variable, return);
ParameterDescription
variableRequired. Specifies the variable to return information about 
returnOptional. When set to true, this function will return the information (not print it). Default is false
PHP PRINT_R() method

examples of the PRINT_R() function

Example 1. In this example, we print the information about some variables in a more human-readable way.

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

echo "<br>";

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

1 comment

Tutor Network

Share this

Learn PHP from A to Z