Foreach issue with empty variables
<p>I'd like to refer back to my original question: <a href="http://stackoverflow.com/questions/14798794/populating-a-calendar-with-php-foreach-code">Populating a calendar with PHP foreach code</a></p>

<p>When working on a localhost server, the script works, however when uploaded online, the calendar does not appear, and Chrome gives me the following errors:</p>

<pre><code>&lt;b&gt;Warning&lt;/b&gt;:  array_values() [&lt;a href='function.array-values'&gt;function.array-values&lt;/a&gt;]: The argument should be an array in &lt;b&gt;/home/flyeurov/public_html/lib/skins/flyeuro/events/events_index.tpl&lt;/b&gt; on line &lt;b&gt;30&lt;/b&gt;
&lt;b&gt;Warning&lt;/b&gt;:  array_merge() [&lt;a href='function.array-merge'&gt;function.array-merge&lt;/a&gt;]: Argument #2 is not an array in &lt;b&gt;/home/flyeurov/public_html/lib/skins/flyeuro/events/events_index.tpl&lt;/b&gt; on line &lt;b&gt;30&lt;/b&gt;
&lt;b&gt;Warning&lt;/b&gt;:  Invalid argument supplied for foreach() in &lt;b&gt;/home/flyeurov/public_html/lib/skins/flyeuro/events/events_index.tpl&lt;/b&gt; on line &lt;b&gt;30&lt;/b&gt;&lt;br /&gt;
</code></pre>

<p>I have discovered that this is happening when I have no events happening in the past = <code>$history</code> therefore empty, or events planned for the future = <code>$events</code> empty.</p>

<pre><code>foreach(array_merge(array_values($history), array_values($events)) as $event)
</code></pre>

<p>But my system is bound sometimes not to have any events planned, hence empty <code>$event</code>, so my question is, how can I bypass the foreach to display the calendar anyway with one or the other empty variable?</p>
