Skip to content

Instantly share code, notes, and snippets.

@VictorFursa
Created August 12, 2015 09:18
Show Gist options
  • Save VictorFursa/edde6946106abde346ff to your computer and use it in GitHub Desktop.
Save VictorFursa/edde6946106abde346ff to your computer and use it in GitHub Desktop.
$array = array(
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100),
rand(1,100)
);
$box = array();
создаю цикл фор for($i=0; $i < count($array);$i++){
если существует значение масива аррай if(isset ($array[$i+1])){
тогда мы сравниваем если if($array[$i] < $array[$i+1]){
если аррай 0 меньше за аррай 1 тогда мы записываем $suma = $array[$i];}}
потом $box[]= $suma заполняем наш пустой масив
выводим var_dump($box);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment