1
Array ( [Screens] => 
   Array ( [0] => 
      Array ( [ SPKRS ] => 
          Array ( [price] => 455 
                  [quantity] => 3
                  [image] =>

                )
          )      
     ) [Software] => Array 
           ( [0] => Array 
             ( [Pricing] => 
                 Array ( [price] => 2 
                         [quantity] => 2 
                         [image] => SOFTWARE.png 

               [ALDELO FOR RESTAURANTS] => Array 
                       ( [price] => 535 
                         [quantity] => 1 
                         [image] =>

) ) ) [Networking] => Array
 ....

the array is $products

<?php foreach ($products as $product): ?> 
   <div class="box-active">
    <div class="line">
    <div class="text left">
    <p><?php print key($product); ?></p>

it prints 0 for all three

1
  • Your array keys aren't valid. Can you replace the code in your question with a var_dump of the array? Commented Sep 6, 2010 at 22:07

1 Answer 1

3

Try this:

<?php foreach ($products as $key => $product): ?> 
   <div class="box-active">
    <div class="line">
    <div class="text left">
    <p><?php print $key; ?></p>

See manual page on foreach

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.