Jump to content

Reg Ex Help


doh85

Recommended Posts

I am gathering some data from a website to do with currencies. I have managed to strip out the rates into this format.

 

price['AFN:CUR'] = 45.17

 

The rates are all structured like this, however i want them to be structured like this, but stored in 2 separate variables.

So for example:

 

echo $country_code[$i]; // AFN

echo $rate[$i]; // 45.17

 

AFN 45.17

 

Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/218746-reg-ex-help/
Share on other sites

That has worked a treat, thank you very much.

 

I have one more slight issue, "price['KPW:CUR'] = -99;" this one has not shown up. I have checked the original file to see.

 

This currency is currently unavaliable.

 

How would i go about editing the code to still pull the value of this even if the rate is -99?

 

I have formatted the outputs to be displayed like so:

 

echo $country_code[$i].' - ';
echo $rate[$i].' <br/> ';

 

At the very bottom its showing just a '-', how would i go about removing it, it must mean that the value is empty or something like that?

Link to comment
https://forums.phpfreaks.com/topic/218746-reg-ex-help/#findComment-1134554
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.