php: function breaks when included from different file
<p>I'm trying to write a wrapper around Image_Graph bar charts.
I actually wrote the whole thing but in the end didn't work, so now I'm back to the basics.
This code below is taken directly from the ImageGraph website as a bar chart example. I just wrapped it in a function (where $data is ignored for now).</p>

<p>This function works fine if I call it from the same file it's defined in (say, function.php). However, if I make a second file, caller.php where I just include_once or require_once this file function.php and then just call the function, it breaks.</p>

<p>Can anyone help me? I'm probably doing some basic mistake but I just can't figure it out. It might also be something specific to Image_Graph because if I make a simple function that just prints Hello World and call that from another file, it works fine.</p>

<p>Thanks,
Daniel</p>

<pre><code>&lt;?php
include_once('Image/Graph.php');

function DrawBarChart($width, $height, $data)
{
 // create the graph
 $graph = Image_Graph::factory('graph', array($width, $height));

 // create the plotarea
 $plotArea =&amp; $graph-&gt;addNew('plotarea');

 // create a dataset
 $dataset =&amp; Image_Graph::factory('dataset');

 // add points
 $dataset-&gt;addPoint('Denmark', 10); 
 $dataset-&gt;addPoint('Norway', 3); 
 $dataset-&gt;addPoint('Sweden', 8); 
 $dataset-&gt;addPoint('Finland', 5); 

 $plot =&amp; $plotArea-&gt;addNew('bar', &amp;$dataset); 

 $graph-&gt;done();
}
?&gt; 
</code></pre>
