3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Say we have a 74-page file $num_pages = 74; // Fill an array of commands. $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"; // Or, y'know, run them directly with shell_exec or something. // shell_exec("pdftk A=the.pdf cat A{$i}-{$next} output the_pages_{$i}-{$next}.pdf"); } print_r($sections); // Then of course run them all.

preferences:
54.76 ms | 402 KiB | 5 Q