title: php call another function in a function
body: <p>im trying to call a function inside another function. based on some research they say using   </p>
  
  <blockquote>
    <p>$this-></p>
  </blockquote>
  
  <p>should work. but it gave me  </p>
  
  <blockquote>
    <p>Fatal error: Using $this when not in object context </p>
  </blockquote>
  
  <pre><code>function addstring($input, $addition_string , $position) {
      $output = substr_replace($input, $addition_string, $position, 0);
      return $output;
  }
  
  
  function test($astring) {
      $output2 = $this-&gt;addstring($astring, 'asd', 1);
  }
  </code></pre>
  
  <p>to view the rest of my code : </p>
  
  <blockquote>
    <p><a href="http://pastebin.com/5ukmpYVB" rel="nofollow">http://pastebin.com/5ukmpYVB</a></p>
  </blockquote>
  
  <p>error : </p>
  
  <blockquote>
    <p>Fatal error: Using $this when not in object context in BLA.php on line 48</p>
  </blockquote>