Skip to content

Instantly share code, notes, and snippets.

View dojohnso's full-sized avatar

Doug dojohnso

View GitHub Profile
@dojohnso
dojohnso / remove_non_utf8_characters
Last active August 29, 2015 14:11
function remove_non_utf8_characters() - just a handle function that can take an array or string and strip out those pesky non-utf8 characters that you see (or don't) sometimes.
<?php
/**
* $data mixed - will accept strings or arrays - the data to be cleaned
* $key mixed - will accept strings or arrays - if passed in, the array_walk will only clean those fields
*
*/
function remove_non_utf8_characters( $data, $key = null )
{
// from http://magp.ie/2011/01/06/remove-non-utf8-characters-from-string-with-php/
@dojohnso
dojohnso / simple_backtrace.php
Last active August 29, 2015 13:56
simple_backtrace() is an easier to read, configurable version of debug_backtrace(), making debugging your code more fun... or at least just easier. Read more about it here: [link coming soon]
/**
* a simpler version of debug_backtrace()
*
* @param boolean $show_args Pass true to display argument values in the output
* @param boolean $expand_objects when $show_args == true, pass true to expand object values, default to false to avoid over-verbosity
*
*/
function simple_backtrace( $show_args = false, $expand_objects = false )
{
$tracers = debug_backtrace();