(1) Generate a file, which is required to have 1000 lines, each line is the number of lines in the line;
(2) Calculate the number of all characters in the file;
(3) All ten numbers 0 1 2 3 4 5 6 7 8 9 appear several times in the statistical file.
<?php $arr=array();$sum=0;for($i=0;$i<10;$i ){ $arr[$i]=0;}for( $i=1;$i<=1000;$i ){ echo $i.'<hr>'; $k=$i; for($j=0;$j<=3;$j ){ $ m=$k; 10;$i ){ echo $i.' appears: '.$arr[$i].'times'.'<hr>'; $sum =$arr[$i];}echo 'Total Characters: '.$sum.'piece';?>
Take a rough look and this should be able to achieve the above three points. (Characters do not include spaces)
for language?
You are talking about a for loop, right? To achieve these three requirements?
<?php $arr=array();$sum=0;for($i=0;$i<10;$i ){ $arr[$i]=0;}
for( $i=1;$i<=1000;$i ){ echo $i.'<hr>'; $k=$i; for($j=0;$j<=3;$j ){ $ m=$k; 10;$i ){ echo $i.' appears: '.$arr[$i].'times'.'<hr>'; $sum =$arr[$i];}
echo 'Total Characters: '.$sum.'piece';?>
Take a rough look and this should be able to achieve the above three points. (Characters do not include spaces)
for language?
You are talking about a for loop, right? To achieve these three requirements?