title: Codeigniter - Parse error: syntax error, unexpected '$this'
body: <p>I am starting to learn codeigniter. I get this error while trying to run the project.</p>
  
  <blockquote>
    <p>Parse error: syntax error, unexpected '$this' (T_VARIABLE), expecting
    ';' or '{' in C:\xampp\htdocs\Codeigniter\application\models\post.php
    on line 5</p>
  </blockquote>
  
  <p><strong>My Model-post.php:</strong></p>
  
  <pre><code>class Post extends CI_Model{
      function get_posts($num=20, $start=0)
          $this-&gt;db-&gt;select()-&gt;from('posts')-&gt;where('active',1)-&gt;order_by('date_added','desc')-&gt;limit($start,$num);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;result_array();
      }
  }
  </code></pre>
  
  <p><strong>My Controller-posts.php:</strong></p>
  
  <pre><code>&lt;?php
  class Posts extends CI_Controller{
      function index(){
          $this-&gt;load-&gt;model('post');
          $data['posts'] = $this-&gt;post-&gt;get_posts();
          print_r($data['posts']);
      }
  }
  </code></pre>