<?php
$names = [ "Миша" , "Паша" , "Никита" , "Серёжа" , "Петя" , "Саша" , "Слава" , "Кирилл" , "Игорь" , "Багратион" , "Фёдор" ] ;
$numberOfPupils = 10 ;
$temp1 = mt_rand ( 1 , $numberOfPupils ) ; $temp2 = 0 ;
for ( $i = 1 ; $i <= $numberOfPupils ; $i ++ ) {
$classList [ $i ] [ 'name' ] = $names [ $index ] ;
$classList [ $i ] [ 'height' ] = 150 + mt_rand ( 0 , 50 ) ; if ( $i == $temp1 ) {
$classList [ $i ] [ 'isAnone' ] = 'Это анон' ;
}
else {
$classList [ $i ] [ 'isAnone' ] = '' ;
} ;
echo "{$classList [$i ]['name']} {$classList [$i ]['height']} {$classList [$i ]['isAnone']} <br>" ;
} ;
$maxHeight = 0 ;
for ( $i = 1 ; $i <= $numberOfPupils ; $i ++ ) {
if ( $maxHeight < $classList [ $i ] [ 'height' ] ) {
$maxHeight = $classList [ $i ] [ 'height' ] ;
$maxIndex = $i ;
}
} ;
echo "Самым высоким учеником класса является {$classList [$maxIndex ]['name']}, его рост - {$classList [$maxIndex ]['height']}. {$classList [$maxIndex ]['isAnone']} <br> " ;
for ( $i = 1 ; $i <= $numberOfPupils ; $i ++ ) {
if ( $i != $temp1 ) {
if ( $classList [ $i ] [ 'height' ] > $classList [ $temp1 ] [ 'height' ] ) {
$temp2 ++;
}
}
} ;
echo "Выше нашего любимого анона оказалось $temp2 одноклассников." ;
?>
PD9waHAKCSRuYW1lcyA9IFsi0JzQuNGI0LAiLCLQn9Cw0YjQsCIsItCd0LjQutC40YLQsCIsItCh0LXRgNGR0LbQsCIsItCf0LXRgtGPIiwi0KHQsNGI0LAiLCLQodC70LDQstCwIiwi0JrQuNGA0LjQu9C7Iiwi0JjQs9C+0YDRjCIsItCR0LDQs9GA0LDRgtC40L7QvSIsItCk0ZHQtNC+0YAiXTsKCSRudW1iZXJPZlB1cGlscyA9IDEwOwoJJHRlbXAxID0gbXRfcmFuZCgxLCRudW1iZXJPZlB1cGlscyk7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