Check whether a string contains invisible characters json_encode($string) Source: SO: Cannot get array element by key, but key exists on array