Beh secondo me non è php ma bensi DHML e javascript. Il concetto è di impedire la stampa degli elementi che non vuoi che vengano stampati (o solo stampare gli elementi che vuoi - dipende dal numero).

Ad esempio :

codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
.noprint {}
-->
</style>

<script language="JavaScript" type="text/javascript">
<!--
function myBeforePrintFunction() {
 var body = document.body;
 hideForPrinting(body);
} // function myBeforePrintFunction()

function myAfterPrintFunction() {
 var body = document.body;
 showForViewing(body);
} // function myAfterPrintFunction()

function hideForPrinting(anObject) {
 hideOrShow(anObject,1);
} // function hideForPrinting(anObject)

function showForViewing(anObject) {
 hideOrShow(anObject,0);
} // function showForViewing(anObject) 

function hideOrShow(anObject,hide) {
 var a = anObject.children.length;
 var i = 0;
 for (i=0;i<a;i++) {
  var son = anObject.children.item(i);
	hideForPrinting(son);
 } // for (i=0;a<i;i++)
 if (anObject.className == "noprint") {
  anObject.style.visibility = hide == 1 ? "hidden" : "visible";
 } // if (anObject.className == "noprint") 
} // function hideForPrinting(anObject)

window.onbeforeprint =  myBeforePrintFunction;
window.onafterprint  =  myAfterPrintFunction;
//-->
</script>

</head>
<body>
<div class="noprint"> testo prima </div>
<table summary="" border="1">
<tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr>
<tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr><tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr><tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr><tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr>
</table>

La prima riga della tabella e le 2 ultime celle della 4 colonna non verranno stampate

<table summary="" border="1">
<tr class="noprint">
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr>
<tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr><tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td><td>11111111</td>
</tr><tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td class="noprint">11111111</td><td>11111111</td>
</tr><tr>
<td>11111111</td><td>11111111</td><td>11111111</td><td class="noprint">11111111</td><td>11111111</td>
</tr>
</table>

<div class="noprint">testo dopo</div>
<input type="button" class="noprint" value="Stampa" onclick="window.print()">
<input type="button" class="noprint" value="Stampa" onclick="myBeforePrintFunction()">

</body>
</html>