1. Home
  2. Computing & Technology
  3. PHP / MySQL

Print_r () PHP Function

By Angela Bradley, About.com

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
Examples:
<?php
$Names = array ('a' => 'Angela', 'b' => 'Bradley', 'c' => array ('Cade', 'Caleb'));
print_r ($Names);
?>
The results would be something like:

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

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Print_R PHP - Print Array PHP - Print_R PHP Array

©2008 About.com, a part of The New York Times Company.

All rights reserved.