PHP Classes

File: 01_basic_usage.php

Recommend this page to a friend!
  Classes of Alexandre Sinício   PHP Array into HTML Table   01_basic_usage.php   Download  
File: 01_basic_usage.php
Role: Example script
Content type: text/plain
Description: Example - Basic usage
Class: PHP Array into HTML Table
Generate HTML tables from data in arrays
Author: By
Last change:
Date: 7 years ago
Size: 535 bytes
 

Contents

Class file image Download
<?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")
    );
   
   
$table = new HTMLTable();
   
$table->createTableTag(true);
   
$table->setData($arrData);
   
$table->setHeaders($arrHeaders);
   
$table->setTableClasses("myTableClass", "maybeAnotherClass");
   
$table->setTableID("myTableID");
    echo
$table->getHTML();