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.

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

mail(‘prajapati.nilesh@gmail.com’, ‘Hi Array Value here….’, $resultsPrint_r_mail);

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: