<html><head><title>Using printf() to format a list of product prices</title></head><body><?php$products = Array("Pencil"=>"222.4", "Cake"=>"4", "Coffee table"=>80.6);print "<pre>";printf("%-20s%23sn", "Name", "Price");printf("%'-43sn", "");foreach ( $products as $key=>$val ) printf( "%-20s%20.2fn", $key, $val );printf("</pre>");?> </body></html>