print_r
Last updated
What is 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 ).
Free resources to learn print_r
- Official docsprint_r
More in stage 3: Arrays
print_r: common questions
Can I learn print_r in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain print_r in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this print_r tutorial for beginners?
It is lesson 21 of 120 in the free PHP roadmap, in stage 3, Arrays. If you are new to PHP, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.