getting the last three characters

I want to query to a table to get the salary of an employee then match this salary figure to another table called categories, if found i should take for example let's say the a employees salary is $5000 and after searching through the categories table and found a matching value and the corresponding category to this value is managing director 8.9. What i need to do is pick the value corresponding to managing director 8.0 which is the basic entry for managing directors.
I can get the employe salary and also i am getting the category but getting the value of the basic entry is the problem. The basic entry is always X.0 where X is a variable. Can someone help me on this please?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve BinkCommented:
If you type it as an integer, the decimal portion will be dropped.
If I understand right.

  You need the last 3 charaters in the Catagory.

I would query for the catagory and assign is to a string, Then I would use substr to get the last 3 char of the catagory..
$Catagory = Your SQL statement returning the catagory column.
$lastthree = substr($Catagory,strlen($Catagory) -3)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AtourayAuthor Commented:
Ok i am getting the three digits right. But now after getting the digits that is after getting 8.6 and cast type it to 8.0, i am to concatenate it from the original string i got it from, for example "managing director 8.0" Any idea how can do this.?? I have different categories not only managing director.
Steve BinkCommented:
Building on edwardq's example:

// $category is the SQL return
$lastthree = substr($category, strlen($category)-3);  // 8.6
$originalname = substr($category, 0, -3);  // "Managing Director "
$intlastthree = floor($lastthree);  // 8
$newname = $originalname . sprintf("%.1f",$intlastthree); // "Managing Director 8.0"

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.