Like in a lot of companies, SalesForce is used to manage customer file and information.

Our application need to interface with the SF Database to either update/create records or fetch some information for our support/marketing.

We encounter a weird issue where we started to have problems with our salesforce ID not being recognized correctly with their API. After some research I discovered that SalesForce use 2 types of ids.

The first one is a 15 case-sensitive ID and the other an 18 case-insensitive ID. From their documentation, the 18 chars one is the new standard. I had to find how to generate the 18 from the 15.

I found a code done in APEX that I translated in PHP. I hope it will be as useful to me as it is to you.