What to do, If a variable inside an foreach loop in PHP : <p>This is my code:</p>

<pre><code>$recommendations_name_list = explode(',',$result[$x]["recommendations_title"]);
$recommendations_vote_average = explode(',',$result[$x]["recommendations_vote_average"]);


foreach( $recommendations_name_list as $index =&gt; $recommendations_title ) {
           echo'&lt;p&gt;'.$recommendations_title.'&lt;/p&gt;
                &lt;p&gt;'.$recommendations_vote_average[$index].'&lt;/p&gt;';
}
</code></pre>

<p>Now, If in the  9th loop<code>$recommendations_title</code> have some value but  <code>$recommendations_vote_average[$index]</code> do not have a value. Then I get this error:</p>

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