Last active
February 4, 2020 10:22
-
-
Save iruwl/a4a5d573e99d46574c7a to your computer and use it in GitHub Desktop.
Sample CodeIgniter Helper With Static Method #codeigniter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Created by irul@20150322 | |
* Ref: http://www.paulzepernick.com/uncategorized/codeigniter-helper-with-static-method/ | |
* | |
* Usage: Load this helper, call it -> Kutil::dump('aha!'); | |
* | |
*/ | |
Class Kutil { | |
static function dump ($var, $echo = TRUE) { | |
ob_start(); | |
echo '<pre>'; | |
var_dump($var); | |
echo '</pre>'; | |
$output = ob_get_clean(); | |
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output); | |
if ($echo == TRUE) | |
echo $output; | |
else | |
return $output; | |
} | |
static function dump_exit ($var, $echo = TRUE) { | |
self::dump($var, $echo); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment