Posts

Showing posts from September, 2014

CodeIgniter log

Custom log helper for CodeIgniter framework  For the last few months we were working with the PHP CodeIgniter framework. Every time I was debugging and wanted to write down some variable I had to write this log_messge('error', $tog_this_var ). 18 characters! Horrible. If the variable was boolean, object or array I'd have to write more or add some if statements. So I decided to write a small helper. Maybe you will find it useful. <? if ( !function_exists('l') && !function_exists('l2') && !function_exists('get_parameter_value') ) { function get_parameter_value($param = null) { if (is_null($param)){ return 'NULL'; }else if (!isset($param)){ return "parameter is not SET"; }else if(is_array($param)){ if (empty($param)){ return "empty array()"; }else{ return print_r($param, true); } }else if(is_string($param) || is_float($pa