- print_r: documentation ( source)
- range: documentation ( source)
<?php
// Say we have a 74-page file
$num_pages = 74;
// Fill and array.
$pages = range(1, $num_pages);
$sections = array();
for ($i = 1; $i <= $num_pages; $i = $i+2) {
$next = $i+1;
$sections[] = "pdftk A=the.pdf cat A{$i}-{$next} output the_pages_{$i}-{$next}.pdf";
}
print_r($sections);