- preg_match: documentation ( source)
- round: documentation ( source)
- trim: documentation ( source)
- sleep: documentation ( source)
<?php
$c = 0;
while ($c++ != 5)
{
// here is curl request, doesn't relevant so I have removed it
preg_match("!<.*?>(\S*)[^<>]*?{$to}<!", $resp, $result) ;
//
echo 'cnt = ' .count($result).'<br>';
if(!count($result))
{
$amount = 0;
echo 'sleep called';
sleep(4);
exit;
continue;
}
else
{
$amount = trim(@$result[1]);
$amount = round($amount + $amount * $exchange_ratio, $precision);
echo 'break happen<br>';
break;
}
}