I'm working on a PHP file which can echo a price (given by an array from another website) converted in a certain currency (let's say in € for example).
I thought about using the in_array function to check if the price retreived from the other webpage contains the currency character or not. Only problem: it doesn't recognize that symbol, even if I use a predefined array. If I try to change the $currency array to the actual price given by the priceclass, it will work. Thanks in advance!
$html=file_get_contents('http://thewebsite');
preg_match_all("thepriceclass", $html, $a);
foreach(end($a) as $key=> $value)
{
print print_r($value, true).'<br>';
$currency = array("€");
$value = str_split($value);
$message = "This listing =/= €";
foreach($value as $letter)
{
if (in_array($letter, $currency))
{
$message = "This listing == €";
break;
}
}
echo $message;
break;
}