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 8971005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:50:55+00:00 2026-06-15T17:50:55+00:00

Assuming I have stored in the database the following withdraw fee = 2 then

  • 0

Assuming I have stored in the database the following

withdraw fee = 2 

then upon withdrawing money i want the user to pay 2% for withdrawal fees for any amount he/she is receiving. Given the code below, it only deducts $2 instead of deducting %2 of the balance.

In my code, $postd_cashout is the fees to pay,
balance is the user’s balance

What change should I make to this line for this to work

$postd_cashout = substr(number_format($ir['balance'], 3, '.', ','), 0, -1);
  • 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-06-15T17:50:57+00:00Added an answer on June 15, 2026 at 5:50 pm
    $postd_cashout = ($ir['balance']*(1.02));
    

    This results in a gross withdrawal of the intended amount plus 2% of that amount. I am unclear if this is exactly what you are trying to achieve, however. The amount the withdrawee receives in hand would be represented in $ir[‘balance’] whereas the gross amount withdrawn is reflected in $postd_cashout.

    optionally:

    $withdrawalmultiplier = 1.02;
    $postd_cashout = ($ir['balance']*($withdrawalmultiplier));
    

    This allows you to change the fee amount anywhere it is referenced in the code as opposed to hardcoding a static number. the intial example is more clear, imho.

    finally:

    $fee = ($postd_cashout - $ir['balance'])
    

    I suppose tracking the fee amount is useful for reporting a sum of fees paid or itemizing a receipt and it sounds like this is ultimately what you’re wanting after re-reading the question a few times. If the fee amount is all you’re after then the other answer fits more elegantly.

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

Sidebar

Related Questions

Assuming I have a numerical string: var foo = 0; Assume I want to
assuming I have the following array: views = [ { :user_id => 1, :viewed_at
Assuming I have a column called A and I want to check if A
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
I have the following record definition: -record(contact, {name, email}) Assuming that I have a
I want to automate process of string localization. Translations are stored in database. The
My idea: I have a database of users, each user has an autoincremented id
Assuming I have the following enum [Flags] enum Options { Option1 = 1 <<
I have users stored in a database that has latitude and longitude set on
I have a cricket database with the following schema: Bowl(BowlID, MatchID, Striker, Non-Striker, Bowler,

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.