Using Anonymous functions in php 5.2 <p>I know Anonymous functions are supported only in php5.3 and above.</p> <p>But due to some difficult circumstances , I have to use the code below in php 5.2</p> <p>Can anybody please help me to convert this to work in php 5.2 </p> <p>====================================================</p> <pre><code> $fn = function($points) use ($pdf) { $op = 'f'; $h = $pdf-&gt;h; $k = $pdf-&gt;k; $points_string = ''; for($i=0; $i &lt; 8; $i+=2){ $points_string .= sprintf('%.2F %.2F', $points[$i]*$k,($h-$points[$i+1])*$k); $points_string .= $i ? ' l ' : ' m '; } $pdf-&gt;_out($points_string . $op); }; </code></pre> <p>====================================================</p> <p>The full code is available at</p> <h1><a href="http://barcode-coder.com/download/php-barcode-2.0.3.zip" rel="nofollow">http://barcode-coder.com/download/php-barcode-2.0.3.zip</a></h1> <p>I have now tried for hours with create_function but somehow can get this to work.</p> <p>Please help me to adapt this to php5.2</p> <p>Also how to duplicate the functionality of use in php5.2</p> <p>ie how to pass a var like $pdf to create_function </p>