浏览代码

Extend sm_print_r so you can do:
sm_print_r($a, $b, $c);

Thijs Kinkhorst 22 年之前
父节点
当前提交
6e8d622861
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      functions/strings.php

+ 6 - 3
functions/strings.php

@@ -439,15 +439,18 @@ function makeComposeLink($url, $text = null)
 }
 }
 
 
 /** 
 /** 
-* sm_print_r($some_variable);
+* sm_print_r($some_variable, [$some_other_variable [, ...]]);
 * Debugging function - does the same as print_r, but makes sure special
 * Debugging function - does the same as print_r, but makes sure special
 * characters are converted to htmlentities first.  This will allow
 * characters are converted to htmlentities first.  This will allow
 * values like <some@email.address> to be displayed.
 * values like <some@email.address> to be displayed.
 * The output is wrapped in <pre> and </pre> tags.
 * The output is wrapped in <pre> and </pre> tags.
 */
 */
-function sm_print_r($var) {
+function sm_print_r() {
     ob_start();  // Buffer output
     ob_start();  // Buffer output
-    print_r($var);
+    foreach(func_get_args() as $var) {
+        print_r($var);
+        echo "\n";
+    }
     $buffer = ob_get_contents(); // Grab the print_r output
     $buffer = ob_get_contents(); // Grab the print_r output
     ob_end_clean();  // Silently discard the output & stop buffering
     ob_end_clean();  // Silently discard the output & stop buffering
     print "<pre>";
     print "<pre>";