Mega Code Archive

 
Categories / Php / File Directory
 

Using popen() to Pass Data to the column Application

<html> <head> <title>Using popen() to Pass Data to the 'column' Command</title> </head> <body> <div> <?php $products = array(     array( "A", 2, "red" ),     array( "B", 3, "blue" ),     array( "C", 1, "pink" ),     array( "D", 1, "orange" )     ); $ph = popen( "column -tc 3 -s / > purchases/user3.txt", "w" )   or die( "Couldn't open connection to 'column' command" ); foreach ( $products as $prod ) {   fputs( $ph, join('/';, $prod). "\n"); } pclose( $ph ); ?> </div> </body> </html>