How to crop image in that order?

I have this picture.
5a33b244ee759935535553.png
As with php to cut it into pieces at 64x64 in the correct order?
<?php

foreach(glob("cut/*") as $file){
unlink($file);
}

$imageFile = "test.png";

list($width, $height) = also, ($imageFile);
$image = imagecreatefrompng($imageFile);
$newImage = imagecreatetruecolor(64, 64);
$index = 1;
for($x = 0; $x <= $width; $x += 64){
 for($y = $height - 64; $y -->= 0; $y -= 64){
 imagecopy($newImage, $image, 0, 0, $x, $y, 64, 64);
 imagepng($newImage, "cut/" . $index++ . '.png');
}
}

This code works, but is 15 pieces creates more.
June 10th 19 at 14:56
1 answer
June 10th 19 at 14:58
Solution
In for replace "<=" on "<"
Thanks, but the first replacement is enough. - Werner_Treutel41 commented on June 10th 19 at 15:01

Find more questions by tags ImagesPHP