fork(3) download
  1. <?php
  2.  
  3. $array = [1,2,3,4];
  4. $isValid = true;
  5. $current = current($array);
  6. while($next = next($array)) {
  7. if($next <= $current) {
  8. return $isValid = false;
  9. }
  10. $current = $next;
  11. }
  12.  
  13. var_dump($isValid);
  14.  
  15. // -----
  16.  
  17. $array = [1,4,3,4];
  18. $isValid = true;
  19. $current = current($array);
  20. while($next = next($array)) {
  21. if($next <= $current) {
  22. $isValid = false;
  23. break;
  24. }
  25. $current = $next;
  26. }
  27.  
  28. var_dump($isValid);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
bool(true)
bool(false)