<?php
$html = <<<EOT
<div id="isOffered">
<a class="price addBetButton footballBetButton" id="bk_82285689_mk_sel1" href="">
<span class="priceText wide UK">1/2</span>
<span class="priceText wide EU">1.50</span>
<span class="priceText wide US">-200</span>
<span class="priceText wide CH">1.50</span>
<span class="priceChangeArrow"></span>
<input class="betCode" type="hidden" value="0]SK@82285689@314222649@NB*1~2*0*-1*0*0]CPN:0" />
<input class="originalBetCode" type="hidden" value="0]SK@82285689@314222649@NB*1~2*0*-1*0*0]CPN:0" />
</a>
</div>
EOT ;
$DOM = new DOMDocument( ) ;
$DOM -> loadHTML ( $html ) ;
$xpath = new DomXpath( $DOM ) ;
$prices = $xpath -> query ( '//*[contains(concat(" ", normalize-space(@class), " "), "priceText ")]' ) ;
$percent = 20.0 / 100.0 ; // 20%
foreach ( $prices as $price ) {
$value = $price -> nodeValue ;
$finalValue = $floatValue - ( $percent * $floatValue ) ;
echo sprintf ( "O valor %.2f teve um desconto de %.2f . Valor com desconto %.2f \r \n " , $floatValue , $percent , $finalValue ) ;
}
PD9waHAKCiRodG1sID0gPDw8RU9UCjxkaXYgaWQ9ImlzT2ZmZXJlZCI+CiAgIDxhIGNsYXNzPSJwcmljZSBhZGRCZXRCdXR0b24gZm9vdGJhbGxCZXRCdXR0b24iIGlkPSJia184MjI4NTY4OV9ta19zZWwxIiBocmVmPSIiPgogICA8c3BhbiBjbGFzcz0icHJpY2VUZXh0IHdpZGUgVUsiPjEvMjwvc3Bhbj4KICAgPHNwYW4gY2xhc3M9InByaWNlVGV4dCB3aWRlIEVVIj4xLjUwPC9zcGFuPgogICA8c3BhbiBjbGFzcz0icHJpY2VUZXh0IHdpZGUgVVMiPi0yMDA8L3NwYW4+CiAgIDxzcGFuIGNsYXNzPSJwcmljZVRleHQgd2lkZSBDSCI+MS41MDwvc3Bhbj4KICAgPHNwYW4gY2xhc3M9InByaWNlQ2hhbmdlQXJyb3ciPjwvc3Bhbj4KICAgPGlucHV0IGNsYXNzPSJiZXRDb2RlIiB0eX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