Skip to content

Instantly share code, notes, and snippets.

@apipkin
Created March 2, 2011 19:41
Show Gist options
  • Save apipkin/851569 to your computer and use it in GitHub Desktop.
Save apipkin/851569 to your computer and use it in GitHub Desktop.
<?php
$str = 'L�a�n�d�e�s�b�e�r�g�.�A�m�y�-�2�0�0�5�_�S�U�N�& o�r�a�n�g�e�,� �g�r�e�e�n�,� �b�l�u�e� �a�n�d� �b�l�u�e�_�4�w�e�b�.�j�p�g�';
echo $str;
echo '<br><br>';
echo cleanUpString($str);
function cleanUpString($val) {
$cleaned = '';
for ($i=0, $l=strlen($val); $i < $l; $i++){
$s = substr($val, $i, 1);
if(ord($s) < 127) {
$cleaned .= $s;
}
}
return $cleaned;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment