How do I get value from multi dimensional arrays?

Discussion in 'PHP' started by News Updates, Jan 14, 2015.

Thread Status:
Not open for further replies.
  1. #1
    I can easily get twitter count as follow
    echo $total_count['twitter'];
    PHP:
    But how can I get facebook likes and shares from this multi dimensional array?

    array(4) {
    ["twitter"]=>int(69)
    ["facebook"]=> array(2) {
             ["total"]=> int(469)
             ["details"]=> array(4) {
                      ["likes"]=> int(189)
                      ["shares"]=> int(153)
                      ["comment"]=> int(127)
                      ["click"]=> int(0)
                      }
             }
    ["google"]=> float(6)
    ["pinterest"]=>int(3285)
    }
    Code (markup):
    Edit: I figured out. It should be
    echo $total_count['facebook']['details']['likes'];
    PHP:

     
    Last edited: Jan 14, 2015
    News Updates, Jan 14, 2015 IP
Thread Status:
Not open for further replies.