View Full Version : PHP Parse error: parse error, expecting `T_FUNCTION'

04-29-2009, 01:57 PM
function randLetter(){
$a = array(0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s ','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R ','S','T','U','V','W','X','Y','Z',0,1,2,3,4,5,6,7,8,9);
$max = count($a)-1;
$rand = rand(0, $max);
return $a[$rand];

function genRandStr($chars){
$out = '';
for($i; $i != $chars; $i++){
$out .= $this->randLetter();
return $out;

Help im getting a this error
PHP Parse error: parse error, expecting `T_FUNCTION' in C:\inetpub\wwwroot\core\classes\core.cls.php on line 34

and line 34 is the return $out;

Whats wrong with it?

04-29-2009, 02:05 PM
Close Please:
I just noticed 2 } where there should be one

04-29-2009, 04:22 PM
You can mark your thread as "resolved", which is as close to closed as it can get.