Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getnumerics($width,$height,$pos,$distance) {
- if($pos < 1 || $pos > $width*$height) {
- die("Invalid Input");
- }
- $rightPosition = $pos+$distance;
- $leftPosition = $pos-$distance;
- for ($i=$pos; $i<=$rightPosition; $i++) {
- for ($j=0; $j<=$distance; $j++) {
- if ($j < $distance && $i < $rightPosition) {
- $arr[$i+($j*$width)] = 0;
- } else {
- $arr[$i+($j*$width)] = 1;
- }
- }
- }
- return $arr;
- }
Add Comment
Please, Sign In to add comment