| 
<?php
use alesinicio\HTMLTable;
 
 require "../HTMLTable.php";
 
 $arrHeaders = array(
 "First column", "Second column", "Third column", "Fourth column"
 );
 
 $arrData = array(
 array("this",     "is",     "first",    "row"),
 array("could",    "come",    "from",     "database")
 );
 
 $tdClassesFunction = function($value) {
 if ($value == "this") {
 return "red";
 } else {
 return null;
 }
 };
 
 $trClassesFunction = function($row) {
 if ($row[1] == "come") {
 return "blue";
 } else {
 return "green";
 }
 };
 
 $table = new HTMLTable();
 $table->setData($arrData);
 $table->setHeaders($arrHeaders);
 $table->setTdClassFunction($tdClassesFunction);
 $table->setTrClassFunction($trClassesFunction);
 echo $table->getHTML();
 
 echo "<style>
 .red{background-color: red;}
 .green{background-color: green;}
 .blue{background-color: blue;}
 .grey{background-color: grey;}
 </style>";
 |