Generating fixed-width field data records : pack « Utility Function « PHP






Generating fixed-width field data records

 
<?php

$books = array( array('A','S',1927),
                array('T','W',1979) );

foreach ($books as $book) {
    print pack('A25A15A4', $book[0], $book[1], $book[2]) . "\n";
}

?>
  
  








Related examples in the same category

1.Format characters for pack( ) and unpack( )