PHP Simple HTML DOM Parser - Return first 2 instead of all

Saturday, July 5, 2014

require 'simple_html_dom.php';
$html = file_get_html("website" . date("Ymd"));

foreach($html->find('td[class=x]') as $element)
echo $element;

I am using the above code to parse a website. Instead of returning all the td elements I would like to return the first two. I think I would need to edit the for loop. How can I do this. I have limited PHP experience.