Back to Developer Roadmap

print_r

src/data/roadmaps/php/content/[email protected]

4.0603 B
Original Source

print_r

The print_r function in PHP is used to print human-readable information about a variable, ranging from simple values to more complex, multi-dimensional arrays and objects. It's exceptionally helpful while debugging, providing more information about the variable's contents than the echo or print functions. For example, in the code $array = array('apple', 'banana', 'cherry'); print_r($array);, it will display Array ( [0] => apple [1] => banana [2] => cherry ).

Visit the following resources to learn more: