I'm new to php and I don't know what why I get a syntax error.
I checked over and over but I can't find where I went wrong!
Parse error: syntax error, unexpected '$string' (T_VARIABLE) in D:\xampp\htdocs\password\generator.php on line 12
<?php
$lower= implode( range('a','z'));
$upper=implode( range('A','Z'));
$number= implode(range('0','9'));
$symbols= '$*?!-';
$char = $lower.$upper.$number.$symbols;
//echo $char2;
//echo rand(1,6);
function random_char($string){
$i = mt_rand (0, strlen($string)-1);
retrun $string[$i];
}
echo random_char($char);
$length=8;
$output='';
for($i =0; $i<$length; $i++){
$output .= random_char($char);
}
echo $output;
?>