ShibSta Posted April 30, 2007 Share Posted April 30, 2007 I have the following code and was wondering how I can display online the value of the title for each array, I am trying to get it to display the title | price | number in a row... <td>Title: $value</td> <td>Price: $value</td> <td>Number: $value</td> <?php $array=array ( array ( Title => "rose", Price => 1.25, Number => 15 ), array ( Title => "daisy", Price => 0.75, Number => 25, ), array ( Title => "orchid", Price => 1.15, Number => 7 ) ); $array_rows=count( $array ); for( $row = 0; $row < $array_rows; $row++ ) { foreach( $array[$row] as $key => $value ) { echo "$value"; } } ?> Link to comment https://forums.phpfreaks.com/topic/49267-solved-multi-dimensional-arrays/ Share on other sites More sharing options...
ShibSta Posted April 30, 2007 Author Share Posted April 30, 2007 Nevermind, I just realized I am making this more difficult than it should be. I need to remove the for() and simplify the foreach(). In other words... SOLVED Link to comment https://forums.phpfreaks.com/topic/49267-solved-multi-dimensional-arrays/#findComment-241404 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.