PHP Print array

by on April 13, 2008 · 0 comments· LAST UPDATED August 25, 2008

in , ,

Q. How do I print array with PHP?

A. You can easily print an array with php using print_r() function. It orints human-readable information about a variable including array.

<?php
  $distro = array ('r' => 'RedHat', 'd' => 'Debian', 'c' => 'CentOS ');
  print_r ($distro);
?>

Sample Output:

Array
(
    [r] => RedHat
    [d] => Debian
    [c] => CentOS
)
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as: , , , , ,

Previous Faq:

Next Faq: