PHP code example of dan-da / texttable-php

1. Go to this page and download the library: Download dan-da/texttable-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dan-da / texttable-php example snippets




 = [];

$timestamp = strtotime('next Sunday');
$days = array();
for ($i = 0; $i < 7; $i++) {
    $data[] = ['Day' => strftime('%A', $timestamp),
               'Abbrev' => strftime('%a', $timestamp),
               'Initial' => strftime('%A', $timestamp)[0],
               'Position' => $i ];
$timestamp = strtotime('+1 day', $timestamp);
    
}

echo "  [  Table with header from first row keys. similar to db result set. ]\n";
echo texttable::table( $data );