Skip to content

Instantly share code, notes, and snippets.

@iruwl
Last active February 4, 2020 10:22
Show Gist options
  • Save iruwl/a4a5d573e99d46574c7a to your computer and use it in GitHub Desktop.
Save iruwl/a4a5d573e99d46574c7a to your computer and use it in GitHub Desktop.
Sample CodeIgniter Helper With Static Method #codeigniter
<?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