Undefined offset error in PHP from json response
<p>The code I wrote supposed to do two things: 1- shows the latest post from a twitter user 2- searches for a specific keyword. For the first part, it works perfectly but it fails in case of 'search' option by dumping this error message:</p>

<blockquote>
  <p>PHP Notice:  Undefined offset:</p>
</blockquote>

<p>I run the code with this format:</p>

<pre><code>$ php script.php search keyword number
</code></pre>

<p>Here is the code:</p>

<pre><code>    $result = file_get_contents("http://search.twitter.com/search.json?q=$argv[2]&amp;rpp=$argv[3]&amp;include_entities=true&amp;result_type=mixed");
    $decoded = json_decode($result,true);
    for($j=0; $j&lt;$argv[3]; $j++)
    {

    echo ($decoded[$j]['text']);



   }
</code></pre>
