Return to Snippet

Revision: 47499
at June 9, 2011 03:59 by aludwig


Initial Code
function simplestringmaker ( $thestring, $hyphens ) {
	$newstring = '';
	for ( $i = 0; $i < strlen( $thestring ); $i++ ) {
		$c = ord(substr($thestring, $i, 1));
		if ( ($c > 47 && $c < 58) || 
			($c > 96 && $c < 123) || 
			($c > 64 && $c < 91) ) {
			$newstring .= strtolower( chr($c) );
		} else if ( $c == 32 && $hyphens ) {
			$newstring .= '-';
		}
	}
	echo $newstring;
}

simplestringmaker ( "It's 419: Gotta Minute..?!", 0 );

Initial URL


Initial Description
The PHP version of simpleStringMaker has an argument to replace spaces with hyphens.

Initial Title
simpleStringMaker

Initial Tags


Initial Language
PHP