<?php

function ucwords_camelcase( $string, $delimiters = '', $encoding = NULL )
{
	return ucwords( strtolower( $string ) );
}

function ucusername( $name )
{
	return preg_replace('/[^A-Za-z0-9\-]/', '', str_replace( ' ', '', ucwords_camelcase( $name ) ) );
}

function rand_string( $length, $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' )
{
	$str	= '';
	$count	= strlen($charset);
	
	while ($length--)
	{
		$str .= $charset[ mt_rand( 0, $count - 1 ) ];
	}
	
	return $str;
}
