title: Grab array item from Xenforo user information Array
body: <p>I have a home page + xenforo forums.
  I want to dispaly users information on homepage if hes logged in.</p>
  
  <p>I found this great code:</p>
  
  <pre><code>&lt;?php
  define('XF_ROOT', 'forums/'); // set this (absolute path)!
  define('TIMENOW', time());
  define('SESSION_BYPASS', false); // if true: logged in user info and sessions are not needed
  
  require_once(XF_ROOT . '/library/XenForo/Autoloader.php');
  
  XenForo_Autoloader::getInstance()-&gt;setupAutoloader(XF_ROOT . '/library');
  
  XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);
  XenForo_Application::set('page_start_time', TIMENOW);
  XenForo_Application::disablePhpErrorHandler();
  XenForo_Application::setDebugMode(false);
  
  if (!SESSION_BYPASS)
  {
      XenForo_Session::startPublicSession();
  
      $visitor = XenForo_Visitor::getInstance();
  
      if ($visitor-&gt;getUserId())
      {
          $userModel = XenForo_Model::create('XenForo_Model_User');
          $userinfo = $userModel-&gt;getFullUserById($visitor-&gt;getUserId());
      }
  }
  
  restore_error_handler();
  restore_exception_handler();
  ?&gt;
  </code></pre>
  
  <p>That does this for me.
  And then i did </p>
  
  <p>var_dump($userinfo);</p>
  
  <p>and it gave me this big array:</p>
  
  <pre><code>array(61) { ["user_id"]=&gt; int(1) ["username"]=&gt; string(4) "Jony" ["email"]=&gt; string(20) "artemkller@gmail.com" ["gender"]=&gt; string(0) "" ["custom_title"]=&gt; string(0) "" ["language_id"]=&gt; int(1) ["style_id"]=&gt; int(0) ["timezone"]=&gt; string(13) "Europe/London" ["visible"]=&gt; int(1) ["user_group_id"]=&gt; int(2) ["secondary_group_ids"]=&gt; string(3) "3,4" ["display_style_group_id"]=&gt; int(3) ["permission_combination_id"]=&gt; int(7) ["message_count"]=&gt; int(0) ["conversations_unread"]=&gt; int(0) ["register_date"]=&gt; int(1362857171) ["last_activity"]=&gt; int(1362949375) ["trophy_points"]=&gt; int(1) ["alerts_unread"]=&gt; int(0) ["avatar_date"]=&gt; int(0) ["avatar_width"]=&gt; int(0) ["avatar_height"]=&gt; int(0) ["gravatar"]=&gt; string(0) "" ["user_state"]=&gt; string(5) "valid" ["is_moderator"]=&gt; int(1) ["is_admin"]=&gt; int(1) ["is_banned"]=&gt; int(0) ["like_count"]=&gt; int(0) ["warning_points"]=&gt; int(0) ["dob_day"]=&gt; int(0) ["dob_month"]=&gt; int(0) ["dob_year"]=&gt; int(0) ["status"]=&gt; string(0) "" ["status_date"]=&gt; int(0) ["status_profile_post_id"]=&gt; int(0) ["signature"]=&gt; string(0) "" ["homepage"]=&gt; string(0) "" ["location"]=&gt; string(0) "" ["occupation"]=&gt; string(0) "" ["following"]=&gt; string(0) "" ["ignored"]=&gt; string(0) "" ["csrf_token"]=&gt; string(40) "9fe480c5ed5a27d3a888a1ec6e1f4fa2c0109db4" ["avatar_crop_x"]=&gt; int(0) ["avatar_crop_y"]=&gt; int(0) ["about"]=&gt; string(0) "" ["facebook_auth_id"]=&gt; int(0) ["custom_fields"]=&gt; string(0) "" ["show_dob_year"]=&gt; int(1) ["show_dob_date"]=&gt; int(1) ["content_show_signature"]=&gt; int(1) ["receive_admin_email"]=&gt; int(1) ["email_on_conversation"]=&gt; int(1) ["is_discouraged"]=&gt; int(0) ["default_watch_state"]=&gt; string(0) "" ["alert_optout"]=&gt; string(0) "" ["enable_rte"]=&gt; int(1) ["allow_view_profile"]=&gt; string(8) "everyone" ["allow_post_profile"]=&gt; string(8) "everyone" ["allow_send_personal_conversation"]=&gt; string(8) "everyone" ["allow_view_identities"]=&gt; string(8) "everyone" ["allow_receive_news_feed"]=&gt; string(8) "everyone" }
  </code></pre>
  
  <p>My question:</p>
  
  <p>Let's say I want to grab the 'Username' from the array which is </p>
  
  <pre><code>["username"]=&gt; string(4) "Jony"
  </code></pre>
  
  <p>How do I do so? I've never worked with arrays in PHP, I am pretty new.</p>
  
  <p>Thanks a lot!</p>