Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 830227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:00:42+00:00 2026-05-15T04:00:42+00:00

I am importing a file which has amount with different currency signs £12.10 $26.13

  • 0

I am importing a file which has amount with different currency signs

£12.10
$26.13
€12.50

I need to import and convert this into single currency. I am splitting the string as follows

$parts = split(' ', preg_replace("/([0-9])/", ' ${1}', $amount, 1));

Couldn’t make preg_split work with PREG_SPLIT_DELIM_CAPTURE

$parts = preg_split("/\d/", $amount, 2, PREG_SPLIT_DELIM_CAPTURE);

I have an array of currency sign to currency code

$currencySymbols = array('£'=>'GBP', '$'=>'USD','€'=>'EUR')

I need to
1. split the string into currency sign and value – if there is a better way then what i am doing
2. map the currency sign to currency code. Not able to map with $currencySymbols[$parts[0]]

Any help will be appreciated. (PHP 5.2.6) using charset=utf-8

Many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:00:42+00:00Added an answer on May 15, 2026 at 4:00 am

    You should probably use the NumberFormatter::parseCurrency to do this instead of regular string manipulation.

    Although most of the time the currency symbol will come before the numeric value, there are some European countries where the currency symbol is written last.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am importing a csv file which has a lot of invoice data. This
I am currently importing a CSV file which has a column that is all
I'm importing a C project to Eclipse CDT which has a preinclude header file.
I have table nol_voa with different values and I am importing xml file with
I am importing data from a CSV file into a postgreSQL table. The table
I am importing a very large file (2-3 GB of text) into a collection,
I have some questions about importing data from Excel/CSV File into SQL Server. Let
I need to make an excel file which would fetch data from connection to
I'm currently importing all of our PHP websites into SVN repositories. Each site has
Here is a peculiar scenario: I am trying to import a tab-delimited file into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.