Changeset 613 for trunk/lib/Utilities.inc.php
- Timestamp:
- Oct 3, 2017 7:16:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r609 r613 31 31 * @param mixed $var The variable to dump. 32 32 * @param bool $display Print the dump in <pre> tags or hide it in html comments (non-CLI only). 33 * @param bool $ var_dump Use var_dump instead of print_r.33 * @param bool $dump_method Dump method. See SC_DUMP_* constants. 34 34 * @param string $file Value of __FILE__. 35 35 * @param string $line Value of __LINE__ 36 36 */ 37 function dump($var, $display=false, $var_dump=false, $file='', $line='') 37 define('SC_DUMP_PRINT_R', 0); 38 define('SC_DUMP_VAR_DUMP', 1); 39 define('SC_DUMP_VAR_EXPORT', 2); 40 function dump($var, $display=false, $dump_method=SC_DUMP_PRINT_R, $file='', $line='') 38 41 { 39 42 $app =& App::getInstance(); … … 44 47 echo $display ? "\n<br />DUMP <strong>$file $line</strong><br /><pre>\n" : "\n<!-- DUMP $file $line\n"; 45 48 } 46 if ($var_dump) { 47 var_dump($var); 48 } else { 49 50 switch ($dump_method) { 51 case SC_DUMP_PRINT_R: 52 default: 49 53 // Print human-readable descriptions of invisible types. 50 54 if (null === $var) { … … 61 65 print_r($var); 62 66 } 63 } 67 break; 68 69 case SC_DUMP_VAR_DUMP: 70 var_dump($var); 71 break; 72 73 case SC_DUMP_VAR_EXPORT: 74 var_export($var); 75 break; 76 } 77 64 78 if ($app->cli) { 65 79 echo "\n";
Note: See TracChangeset
for help on using the changeset viewer.