Guest User

Untitled

a guest
Oct 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2.  
  3. function getnumerics($width,$height,$pos,$distance) {
  4. if($pos < 1 || $pos > $width*$height) {
  5. die("Invalid Input");
  6. }
  7.  
  8. $rightPosition = $pos+$distance;
  9. $leftPosition = $pos-$distance;
  10.  
  11. for ($i=$pos; $i<=$rightPosition; $i++) {
  12. for ($j=0; $j<=$distance; $j++) {
  13. if ($j < $distance && $i < $rightPosition) {
  14. $arr[$i+($j*$width)] = 0;
  15. } else {
  16. $arr[$i+($j*$width)] = 1;
  17. }
  18. }
  19. }
  20.  
  21. return $arr;
  22. }
Add Comment
Please, Sign In to add comment