search

Home  >  Q&A  >  body text

Randomly generate 200 lowercase English letters and count the number. This is a particle I saw online. I would like to ask how to make it simpler?

<html>
    <head>
 <meta charset="UTF-8">
 <title></title>
    </head>
    <body>
    <?php
$z=adbqhwbqjuyguqwgyquiwguyquwehqwuiepoqiuwepoqiuwpoiqwepiqwruweroiuyiqazxswedcvfrtgbnhyujmkilopplmkoijnbhuygvcftrdxzsewqa;
$a="abcdefghijklmnopqrstuvwsyz";
for($i=0;$i<strlen($a);$i++){
    $s=$a[$i];
    $b=0;
    for ($j=0;$j<strlen($z);$j++){
        if ($a[$i]==$z[$j]){
            $b+=1;
        }
    }
    echo $a{$i}."出现的次数:".$b."<br>";
}
?>
1
 
       </body>
</html>
# PHP

DeitiesDeities1172 days ago1214

reply all(5)I'll reply

  • autoload

    autoload2021-11-04 09:14:12

    Random uppercase letters chr(rand(65,90)); Random lowercase letters chr(rand(97,122)); can simplify entering so many characters

    reply
    0
  • Deities

    What I want to ask is how to simplify the output and output 200 lowercase English characters at one time

    Deities · 2021-11-04 11:22:13
    autoload

    Use loop

    autoload · 2021-11-04 13:55:33
  • Cancelreply