Search the Community
Showing results for tags 'bank'.
-
Hello, I don't really see how to integrate payment via RevolUt into my website despite having read the documentation from the official RevolUt website. Please give me some advice. Have a good day !
-
Howdy folks! Please go easy on me, I'm relatively new to programming and still climbing through the basics. My code is pretty simple. User gotta pick "d" or "w" to deposit or withdraw his fake virtual money, then he picks the amount and the awesomely cool calculation transpires But it doesn't work. No matter what is being picked the keyboard always goes to the "else" condition (which tells the user "You can only use enter 'w' or 'd'" -- despite the fact I input "d" or "w"). Basically it completely skips my "if" and "else if" statements. I tried putting "d" in quotations, without, with tags, with what not! So, any clue what is being done wrong here? <?php $balance=1000; echo "Welcome to your bank. Your balance is " . $balance . " Which action would you like to take? (w=withdraw, d=deposit) \n" ; $user=fgets(STDIN); if ($user=="w") { echo "How much would you like to withdraw? \n"; (int)$sum=fgets(STDIN); $balance = $balance-$sum; echo "Money successfully withdrawn. Your balance now stands at" . $balance . ""; } else if ($user=="d") { echo "How much would you like to deposit? \n"; $sum=fgets(STDIN); $balance = $balance+$sum; echo "Money successfully deposited. Your balance now stands at" . $balance . "" ; } else { echo "You can only use enter 'w' or 'd'"; } ?>