Location: PHPKode > scripts > Simple Table Wrapper > example.php
<?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 ?>
Return current item: Simple Table Wrapper