DISQUS

Building Browsergames: Building Browsergames: Creating the bank (PHP)

  • Mattias · 1 year ago
    Hi, I just noticed something about your code. If the user is to enter a negative amount and deposit it, they would get more gold than they had in their hand and get a negative bank value.

    Just thought I'd point it out.
  • Luke · 1 year ago
    Hi Mattias,

    Nice catch! I completely missed that that bug was there. I will post a fix shortly.
  • Mattias · 1 year ago
    An easy way to fix it is to use PHP's abs() function to force the number to be positive :)
  • MrLollige · 7 months ago
    Thanks mattias, that function is helpful!