php - Display multidimensional array dynamically -


i have array,

array ( [part_number] => array     (         [1] => "88888"         [2] => "898989"         [3] => "12312"         [4] => "321321321"     )  [manufacturer] => array     (         [1] => "dell"         [2] => "toshiba"         [3] => "asus"         [4] => "amd"     )  [description] => array     (         [1] => "i3 processor"         [2] => "i5 processor"         [3] => "i7 processor"         [4] => "video card 4gb"     )  [list_price] => array     (         [1] => "450"         [2] => "100"         [3] => "100"         [4] => "150"     )  [net_price] => array     (         [1] => "500"         [2] => "120"         [3] => "120"         [4] => "200"     )  [quantity] => array     (         [1] => "600"         [2] => "150"         [3] => "150"         [4] => "80"     )  [measure] => array     (         [1] => "14 inch"         [2] => "pc/s"         [3] => "pc/s"         [4] => "pc/s"        )     )  

and want display dynamically depending on array values.

sample format:

part_number : "88888" manufacturer : "dell" description : "i3 processor" list_price : "450" net_price : "500" quantity : "600" measure : "14 inch" 

and on…

i'm stuck in part.

here's code

<?php foreach($success_arr $success_part_number => $val): ?>     <?=$success_part_number." : ".$val[1];?> <?php endforeach; ?> 

i want val dynamic. don't know how count number of values return in array.

you run foreach loop inside loop.

   $counter = count($array['manufacturer']);         ($i=0; $i < $counter; $i++)          {              echo "<ul>";             foreach($array $success_part_number => $val)             {                 echo "<li>";                 echo $success_part_number." : ".$val[$i];                 echo "</li>";             }             echo "</ul>";             echo "<hr>";         } 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -