note 18920 modified in function.print-r by alindeman

From: Date: Sat, 12 Apr 2003 16:46:51 +0000
Subject: note 18920 modified in function.print-r by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-46547@lists.php.net to get a copy of this message
[Ed. Note: As of PHP 4.3.0, you can use the return parameter, instead of output control functions --alindeman@php.net] Here's how to use Output buffering with print_r(), and then format it for JScript: // get the variables ob_start(); print_r($HTTP_POST_VARS); $v = ob_get_contents(); ob_end_clean(); // Format them nicely for JS: $v = str_replace( "\n", "\\n", $v ); --was-- Here's how to use Output buffering with print_r(), and then format it for JScript: // get the variables ob_start(); print_r($HTTP_POST_VARS); $v = ob_get_contents(); ob_end_clean(); // Format them nicely for JS: $v = str_replace( "\n", "\\n", $v ); http://www.php.net/manual/en/function.print-r.php

« previous php.notes (#46547) next »