0
<?php $sals=[ 'sachin' => 20000, 'dhoni' => 10000, ]; foreach($sals as$value){ print $value; } ?>
could anyone say in the above code how to print Sachin and dhoni as output
2 Réponses
+ 3
<?php
$sals=[
'sachin' => 20000,
'dhoni' => 10000,
];
foreach($sals as $key => $value){
print $key." ".$value."<br>";
}
?>
+ 1
Maybe if we change a bit
<?php
$sals = array("sachin" => 20000, "dhoni" => 10000);
print_r(array_keys($sals));
?>