PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Michal Pakula   Simple Table Wrapper   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of generated table from arrays
Class: Simple Table Wrapper
Display data from MySQL or arrays in HTML tables
Author: By
Last change:
Date: 13 years ago
Size: 1,326 bytes
 

Contents

Class file image Download
<?php
require('simpletablewrapper.php');
?>
<h2>Example of using SimpleTablewrapper Class</h2>
<br />
<h3>Single-dimensional array</h3>
<table>
<tr>
    <td>
    <h4>example input data:</h4>
    <?php
    $arr
=array('name'=>'James Bond', 'Age'=>'60', 'profession'=>'Special agent');
    echo
nl2br(print_r($arr,1));
   
?>
</td>
    <td width="60px"></td>
    <td>
    <h4>Code</h4>
<pre>
$table = new SimpleTableWrapper($arr);
$table->render();
</pre>
    </td>
    <td width="60px"></td>
    <td>
    <h4>Result</h4>
    <?php
        $table
= new SimpleTableWrapper($arr);
       
$table->render();
   
?>
</td>
</tr>
</table>

<br />
<br />
<br />
<h3>Multi-dimensional array</h3>
<table>
<tr>
    <td>
    <h4>example input data:</h4>
    <?php
    $arr
=array();
   
$arr[]=array('name'=>'James Bond', 'Age'=>'60', 'profession'=>'Special agent');
   
$arr[]=array('name'=>'Roger Moore', 'Age'=>'83', 'profession'=>'James Bond');
   
$arr[]=array('name'=>'Sean Connery', 'Age'=>'80', 'profession'=>'James Bond');
   
    echo
nl2br(print_r($arr,1));
   
?>
</td>
    <td width="60px"></td>
    <td>
    <h4>Code</h4>
<pre>
$table = new SimpleTableWrapper($arr);
$table->render();
</pre>
    </td>
    <td width="60px"></td>
    <td>
    <h4>Result</h4>
    <?php
        $table
= new SimpleTableWrapper($arr);
       
$table->render();
   
?>
</td>
</tr>
</table>

<?php ?>