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

  • Home
  • SEARCH
  • 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 1045811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:02:39+00:00 2026-05-16T16:02:39+00:00

Need to convert RGB or HEX colors to Long Int for another program that

  • 0

Need to convert RGB or HEX colors to “Long Int” for another program that uses this format. Not sure the specifics of the “Long Int” color format though.

It is possible to generate the “Long Int” values manually using this color-picker http://hide-inoki.com/en/soft/chunter/index.html but a php function would be preferred.

hexdec generates the correct “Long Int” for some HEX values (‘FFFFFF’, ‘2F2F2F’) but not others (‘123456’).

  • 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-16T16:02:39+00:00Added an answer on May 16, 2026 at 4:02 pm

    You should be able to use PHP’s hexdec function.

    hexdec('FFFFFF'): 16777215
    hexdec('123456'): 1193046
    

    etc.

    Are you saying these values aren’t correct? Or were you using dechex instead by mistake?


    Update based on your comment which says that color “#123456” should be “5649426” in “Long Int” format:

    5649426 in base 16 is 0x563412, so it’s clear your format requires BGR instead of RGB.

    So just build a “BGR” string from your “RGB” string first then feed it to hexdec:

    $rgb = '123456';
    $bgr = substr($rgb,4,2) . substr($rgb,2,2) . substr($rgb,0,2);
    print hexdec($bgr);
    

    yields 5649426.

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

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have RGB values that I need to convert into CMYK values. I'm using
I have a need to convert images from CMYK to RGB - not necessarily
I need to convert a date from this format: 2002-10-10T12:00:00-05:00 (xs:dateTime as defined in
I have a bunch of .eps files (CMYK) that I need to convert to
I need to convert a string like this: A &#039;quote&#039; is <b>bold</b> into: A
I need to convert latitude/longitude coordinates into Easting/Northing coordinates in the Alberta 10 TM
I need to convert a named instance of SQL server 2005, to a default
I need to convert HTML documents into valid XML, preferably XHTML. What's the best
I need to convert a (possibly) null terminated array of ascii bytes to a
I need to convert a value which is in a DateTime variable into a

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.