$fruits = array('Banana', 'Mango', 'Apple', 'Papaya'); //-------------------------------------- $keys = array_keys($fruits); $Value = array_values($fruits); //---------------------if you print only first key & value echo key($fruits); echo current($fruits); //---------------------Print with for loop $arrLen=count($fruits); for ($i=0; $i<$arrLen; $i++) { echo "$keys[$i] $Value[$i]..."; } //---------------------Print with foreach loop foreach ($fruits as $key => $value) { echo "$key .. $value"; }
Result
_______________________________________