Last active
July 13, 2021 23:42
-
-
Save neomadara/ee4533fd4335711d0ea289b84017a6af to your computer and use it in GitHub Desktop.
Guillotine cutting algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$paginador = 6; | |
$contador_interno = 1; | |
$total_tickets = 18; | |
$cada = ceil($total_tickets/$paginador); | |
$total_pagina = $cada * 5; | |
for($contador = 1; $contador<=$cada; $contador++){ | |
for($contador_interno = $contador; $contador_interno<=$total_pagina+$contador; $contador_interno += $cada){ | |
if($contador_interno<=$total_tickets){ | |
echo $contador_interno.' '; | |
} | |
} | |
echo ' '. PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment