1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Print_r () PHP Function


Young man working on laptop computer at home
Fotostorm/E+/Getty Images
Definition: The Print_r () PHP function is used to return an array in a human readable form. It is simply written as Print_r ($your_array)
Also Known As: Print Array
 $Names = array ('a' => 'Angela', 'b' => 'Bradley', 'c' => array ('Cade', 'Caleb')); 
 print_r ($Names);
The results would be something like:

[a] => Angela
[b] => Bradley
[c] => Array
     [0] => Cade
     [1] => Caleb

Related Video
Basic PHP Syntax
Using PHP With HTML
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Print an array in PHP using print_r ()

©2014 About.com. All rights reserved.