title: Getting message chat id Telegram
body: <h2>Problem</h2>
  
  <p>Hi I want to get message chat id in telegram by Codeigniter. I am not so good in programming. I think I am not using array script properly.</p>
  
  <h2>That gives me error</h2>
  
  <p>Cannot use object of type stdClass as array <strong>C:\OpenServer\domains\localhost\admin\application\controllers\lifeChange.php on line 20</strong></p>
  
  <p>## PHP ##</p>
  
  <pre><code>$chat_id = $update['result'][0]['message']['chat']['id'];
  </code></pre>
  
  <h2>Array</h2>
  
  <pre><code>stdClass Object
  (
  [ok] =&gt; 1
  [result] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [update_id] =&gt; 188680055
                  [message] =&gt; stdClass Object
                      (
                          [message_id] =&gt; 9
                          [from] =&gt; stdClass Object
                              (
                                  [id] =&gt; [number id]
                                  [first_name] =&gt; $ravshan
                                  [last_name] =&gt; = array(' ');
                                  [username] =&gt; antiSmoke
                              )
  
                          [chat] =&gt; stdClass Object
                              (
                                  [id] =&gt; [number id]
                                  [first_name] =&gt; $ravshan
                                  [last_name] =&gt; = array(' ');
                                  [username] =&gt; antiSmoke
                                  [type] =&gt; private
                              )
  
                          [date] =&gt; 1469289772
                          [text] =&gt; /start
                          [entities] =&gt; Array
                              (
                                  [0] =&gt; stdClass Object
                                      (
                                          [type] =&gt; bot_command
                                          [offset] =&gt; 0
                                          [length] =&gt; 6
                                      )
  
                              )
  
                      )
  
              )
  
      )
  </code></pre>
  
  <p>)</p>