Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, © Copyright 2010 All Rights Reserved. 1
Chapter Six Printing Arrays 2 ourses/php/slides/chapter06.printing.ppt
<?php $pop['IA']['Independence'] = 6101; $pop['IA']['Manchester'] = 4898; printf( "print_r( \$pop ); " ); print_r( $pop ); ?> Array ( [IA] => Array ( [Independence] => 6101 [Manchester] => 4898 ) Array Printing Function “print_r” 3
array(1) { ["IA"]=> array(2) { ["Independence"]=> int(6101) ["Manchester"]=> int(4898) } <?php $pop['IA']['Independence'] = 6101; $pop['IA']['Manchester'] = 4898; printf( "var_dump( \$pop ); " ); var_dump( $pop ); ?> Array Printing Function “var_dump” 4
array ( 'IA' => array ( 'Independence' => 6101, 'Manchester' => 4898, ), ) <?php $pop['IA']['Independence'] = 6101; $pop['IA']['Manchester'] = 4898; printf( "var_export( \$pop ); " ); var_export( $pop ); ?> Array Printing Function “var_export” 5
to be continued... ourses/php/slides/chapter06d.printing.ppt