title: Get data from WordPress object array?
body: <p>I am trying the get the value of the WordPress user. I am trying with the get_users() wp function. How can I get the [ user role ] value form the <code>roles</code> key from this array object.
  my php code is</p>
  
  <pre><code>echo '&lt;pre&gt;';
  var_dump(get_users());
  echo '&lt;/pre&gt;';
  </code></pre>
  
  <p>What return the below code</p>
  
  <pre><code>  array(4) {
        [0]=&gt;
        object(WP_User)#510 (7) {
          ["data"]=&gt;
          object(stdClass)#506 (10) {
            ["ID"]=&gt;
            string(2) "12"
            ["user_login"]=&gt;
            string(4) "demo"
            ["user_pass"]=&gt;
            string(34) "$P$Bp7wAWdn9qAPehmbEVcGz7DGGjc.lm1"
            ["user_nicename"]=&gt;
            string(4) "demo"
            ["user_email"]=&gt;
            string(18) "demo@something.com"
            ["user_url"]=&gt;
            string(19) "http://demouser.com"
            ["user_registered"]=&gt;
            string(19) "2015-10-14 12:34:02"
            ["user_activation_key"]=&gt;
            string(45) "1444826043:$P$BT2rYlAjdNo5OqzG7U3CvZw/sdnFqE."
            ["user_status"]=&gt;
            string(1) "0"
            ["display_name"]=&gt;
            string(9) "demo user"
          }
          ["ID"]=&gt;
          int(12)
          ["caps"]=&gt;
          array(1) {
            ["new_contributor"]=&gt;
            bool(true)
          }
          ["cap_key"]=&gt;
          string(15) "wp_capabilities"
          ["roles"]=&gt;
          array(1) {
            [0]=&gt;
            string(15) "new_contributor"
          }
          ["allcaps"]=&gt;
          array(4) {
            ["read"]=&gt;
            bool(true)
            ["edit_posts"]=&gt;
            bool(true)
            ["delete_posts"]=&gt;
            bool(false)
            ["new_contributor"]=&gt;
            bool(true)
          }
          ["filter"]=&gt;
          NULL
        }
  </code></pre>