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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.