I am working on a PHP file which is a value (given by an array from another website) currency (ex. To say in â €?)
I thought of using the in_array function to check whether the price returned from other webpages is currency or not . Only problem: it does not recognize that symbol, even if I use the predefined array if I try to change the $ currency array in the actual value given by the price currency, it will work. Thanks in advance! How many currencies do you have? This is not for all of them, but why not use the iOS code (eg US Dollar, Euro, JPY, etc.)? I will create a little function that converts symbols into code and vice versa. Did you say in the comment that you? Working with ¬, $, £, and PÑ ?? Ð ±. I think the problem is encoding, either because PHP is Latin 1, or such things. I only use the currency code (). In your case: Compare with US Dollar, Euro, GBP, RUB, and this. I do not fully understand your code, as you look for the value of the array, but do you always print? ? ¬. I think this is just for testing. I do: or: If you can not use the above then I want to do something like this ... ... and use array values and keys to compare. Will this work? $ html = file_get_contents ('http: // thewebsite'); Preg_match_all ("thepriceclass", $ html, $ a); Forex Currency ($ $ Key = & gt; $ value as End ($ A)) {print print_r ($ value, true) '& Lt; Br> & # 39; & # 39; $ Currency = array ("â ?? ¬"); $ Value = str_split ($ value); $ Message = "this listing = / = â ?? ¬"; Forex currency ($ letter as $ letter) {if (in_array ($ letter, $ currency)) {$ message = "this list == â ?? ¬"; break; }} $ Message echo; break; }
Edit:
$ currency = array ('EUR');
$ currency = array ('USD', 'EUR', 'GBP', 'RUB');
$ currencies = array ('USD' = & Gt; '$', 'EUR' = & gt; 'â', 'GBP' => 'one £', 'RUB' = & gt; 'PAN ?? Ð ±');
No comments:
Post a Comment