-2

I know its silly question but really I don't know whats wrong, I have class that retrieve an array of parameters,like this with print_r function

Array ( [0] => 
      Array ( [points] => 39930 
              [level] => 14 
              [base] => 32000 
              [next] => 40000 
              [progress] => 99 
              [platinum] => 30 
              [gold] => 112 
              [silver] => 290 
              [bronze] => 1050 
              [total] => 1482 ) )

so if I want specific value from this array I can write

$getCount = $psn->get_count($psnUser['jid']);
echo $getCount['gold'];

the output must be 112 but its show me blank page what should I do?

iLaYa ツ
  • 3,941
  • 3
  • 32
  • 48
OsaMa Hasan
  • 133
  • 2
  • 9
  • 1
    please refer to the [PHP Manual on arrays](http://php.net/arrays) to learn how to access them. Also, make sure to enable error reporting. – Gordon Oct 08 '12 at 08:46
  • Sorry fo being Silly, after submitting the question I saw my response is two dimeinsion array so I used echo $getCount [0]['gold']; which solved my problem. – OsaMa Hasan Oct 08 '12 at 08:46
  • Set your [error_reporting](http://php.net/manual/en/function.error-reporting.php) to ALL on your development server, and set your configuration to display errors - this will give you very useful debug information when developing. Remember to turn display errors off on your production server. – HorusKol Oct 08 '12 at 08:49
  • Read that to learn how to see errors: [Nothing is seen. The page is empty and white.](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/12772851#12772851) – Jocelyn Oct 08 '12 at 10:49

1 Answers1

4

You are dealing with a multidimensional array, so you have to point at:

$getCount[0]['gold'];
moonwave99
  • 21,957
  • 3
  • 43
  • 64