xml片段中的拥挤字符串

this is part of my HTML:

<li class="tel" itemprop="telephone">

+421905343255
                        </li>

I am using Simple html DOM praser and i try to get telephone number

My try of PHP code:

$html = file_get_html('file.txt'); 
$ret = $html->find('li[itemprop="telephone"]');  


foreach ($ret as $translate) {
    $translate = $translate->innertext;
    }   
    echo "$translate"; 

Ideal result should be:

echo "$translate[0]";  //+421905343255

Well, you should store your results in an array with a different name than what you use to loop through the DOM nodes !

$ret = $html->find('li[itemprop="telephone"]');  

foreach ($ret as $translate) {
    $translateResult[] = $translate->innertext;
}   
echo "$translateResult[0]"; 

DEMO