note 69781 added to function.str-replace

From: Date: Wed, 20 Sep 2006 17:55:48 +0000
Subject: note 69781 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-117359@lists.php.net to get a copy of this message
Thanx to the str_replace and some comments I figure some of you would like this function I created. Its from a book, but I highly modified it to create a htm file for easy access under the files directory. Enjoy! <?php function dumpVar() { $file = "\n<!-- BEGIN VARIABLE DUMP --><br /><br />"; $file = $file ."BEGIN GET VARIABLES<br />"; $file = $file .str_replace("\n", '<br />', print_r($_GET, true)) ."<br /><br />"; $file = $file ."BEGIN POST VARIABLES<br />"; $file = $file .str_replace("\n", '<br />', print_r($_POST, true)) ."<br /><br />"; $file = $file ."BEGIN SESSION VARIABLES<br />"; $file = $file .str_replace("\n", '<br />', print_r($_SESSION, true)) ."<br /><br />"; $file = $file ."BEGIN COOKIE VARIABLES<br />"; $file = $file .str_replace("\n", '<br />', print_r($_COOKIE, true)) ."<br /><br />"; $file = $file ."BEGIN FILE VARIABLES<br />"; $file = $file .str_replace("\n", '<br />', print_r($_FILES, true)) ."<br /><br />"; $file = $file ."END VARIABLE DUMP<br /><br />"; // Now we name and create the file. $filename = "files/" .date("ymd-His") .".htm"; $fp = fopen($filename, 'w'); fwrite($fp, $file, strlen($file)); fclose($fp); echo "Variable dump completed<br />"; } ?> ---- Server IP: 216.194.113.175 Probable Submitter: 75.21.186.58 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/69781 Del: integrated -- https://master.php.net/note/delete/69781/integrated Del: useless -- https://master.php.net/note/delete/69781/useless Del: bad code -- https://master.php.net/note/delete/69781/bad+code Del: spam -- https://master.php.net/note/delete/69781/spam Del: non-english -- https://master.php.net/note/delete/69781/non-english Del: in docs -- https://master.php.net/note/delete/69781/in+docs Del: other reasons-- https://master.php.net/note/delete/69781 Reject -- https://master.php.net/note/reject/69781 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117359) next »