Hugo Hugo - 7 months ago 31
PHP Question

PHP Arrays Values

Please provide help on how to write array values if I have array like this:

Array (
[937245328] => $0.79
[310776983] => $0.53
[720315389] => $0.39
[310800933] => $0.30
[1011934667] => $0.28
[1576813623] => $0.21
[926978479] => $0.19
[1011934570] => $0.14
[937244096] => $0.14
[310777321] => $0.13
[384801319] => $0.13
[519987816] => $0.12
[992123310] => $0.11
)


I would like to print this array out somelike this:

937245328: $0.79
310776983: $0.53
720315389: $0.39


and so on... Thanks for any help.

Answer

if your array is called

$myArray

Then you can print it out as follows:

<?php
  foreach ($myArray as $key => $value)
  {
    echo $key.": ".$value."<br>";
  }
?>

Let me know if that worked for you! :)