Hide print_r result in PHP

Print_r function is usually to output the array result, but I want to hide the result it should be seen on the browser is there a certain way to hide it?

The reason why I want to hide it is, because I just realized that to output and sort a big array outside a loop is impossible to do only when I output it with print_r function in the loop and then to sort it and order in a table outside the loop.

Here is a sample

$arr = array('jow', 'jack');//Big array,
$arr1 = array();
foreach($arr as $val){
    $arr1[] = $val;
    print_r($arr1); // hide it here
}
//Order it and sort it outside the loop.

Answers


echo "<!-- \n".print_r($value, TRUE)."\n-->\n\n";

Check your code in your browser through Right Click.


ob_start();
print_r($value);
ob_end_clean();

You can also use CSS to "hide" any output from the browser.

echo "<div style='display: none;'>".print_r($arr1)."</div>";

and later on you can show by changing 'display: none' to 'display: block'.


Need Your Help

How to sort GridView Records in ASP.Net

asp.net sorting gridview

I want to sort databound GridView. I have added GridView in child webform in UpdatePanel. Following is my code.

How to create a service application for Gear S?

tizen background-service tizen-wearable-sdk tizen-web-app service-application

Has anyone succeeded in creating a service application as described in Service Application: Creating a Service Application with Tizen SDK for Wearable 1.0.0?