<?php

function URLstring($input){
	
	// delete some chars that not may be replaced with a space char
	$temp = str_replace(array("'",'"'),'',$input);
	// replace special chars by readable variant
	$temp = str_replace(array('&','@','$'),array(' en ',' at ','dollar'),$temp);
	// replace strange chars to their equivalent
	$temp = preg_replace('#&(.)[a-z]+;#','$1',htmlentities($temp));
	// replace all others by an underscore
	$temp = preg_replace('#[^a-zA-Z0-9\-]+#','_',$temp);
	
	// done, clean up and return the result
	return trim($temp,'-_');
}

function is_validURLstring($string){
	return ($string === urlencode($string));
}

?>

[code]<?php
$string = 'Hipska\'s eerste bericht:"Één grote test met tekens enzo."';

$url = URLstring($string);

var_dump($string,$url,is_validURLstring($url));
?>

string(57) "Hipska's eerste bericht:"Één grote test met tekens enzo.""
string(53) "Hipskas_eerste_bericht_Een_grote_test_met_tekens_enzo"
bool(true)[/code]