Mega Code Archive

 
Categories / Php / Data Type
 

Generating fixed-width field data records without

<?php $books = array( array('A','S', 1927),                 array('T','L',1971),                 array('T','W',1979) ); foreach ($books as $book) {     $title  = str_pad(substr($book[0], 0, 25), 25, '.');     $author = str_pad(substr($book[1], 0, 15), 15, '.');     $year   = str_pad(substr($book[2], 0, 4), 4, '.');     print "$title$author$year\n"; } ?>