<?php
function make_char($length = 1){
$chars = array(
'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'
);
$char_txt = '';
for($i = 0; $i < $length; $i++){
$char_txt .= $chars[array_rand($chars)];
}
return $char_txt;
}
function switch_numbers($a){
switch ($a) {
case 1:
echo "$a<br>";
break;
case 2:
echo "$a<br>";
break;
case 3:
echo "$a<br>";
break;
case 4:
echo "$a<br>";
break;
case 5:
echo "$a<br>";
break;
default:
echo "others<br>";
break;
}
}
function switch_strings($b){
switch ($b) {
case 'a':
echo "$b<br>";
break;
default:
echo "$b<br>";
break;
}
}
switch_numbers(rand(1,6));
switch_strings(make_char());
?>