<?php   error_reporting(E_ALL&~E_NOTICE);

    for(;$r=fgetcsv(STDIN);$a[]=$r)                         // read csv from STDIN, append to array $a
        foreach($r as$x=>$s)$e[$x]=max($e[$x],strlen($s));  // remember max length in array $e
                                                            // print top border
    $t=["┬","┌","┐"];eval($L='foreach($e as$i=>$n)echo$t[!$i],str_repeat("─",$n);echo"$t[2]\n";');
    foreach($a as$k=>$r)
    {
    	foreach($r as$i=>$s)echo"│",str_pad($s,$e[$i]);echo"│\n";   // print title/data row
    	$t=["┼","├","┤"];if(!$k)eval($L);                           // print border below header
    }
    $t=["┴","└","┘"];eval($L);                              // print bottom border
