Posted by: prajapatinilesh | November 7, 2007

print_r function in php

 Prints human-readable information about a variable (PHP 4, PHP 5)

bool print_r ( mixed expression [, bool return] )


 $a = array (‘a’ => ‘apple’, ‘b’ => ‘banana’, ‘c’ => array (‘x’, ‘y’, ‘z’));
$results = print_r($a, true);   //for php 5

If you need to capture the output of print_r() with a version of PHP prior to 4.3.0, use the output-control functions.

echo “<pre>”;
print_r($a );
echo “</pre>”;
$resultsPrint_r_mail = ob_get_contents();

mail(‘’, ‘Hi Array Value here….’, $resultsPrint_r_mail);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: