How to get index values of an array using php

$topcom=array(‘color’=>’red’,’type’=>’box’,’height’=>’10px’,’weight’=>’2kg’);

How to get the properties of this array and its values)

foreach ($topcom as $eachindex => $eachvalue){
echo ‘$eachindex’ .”=>”. $eachvalue.”<br />”;
}