Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Formula Issue

  1. #1
    Regular Coder
    Join Date
    Jun 2009
    Posts
    278
    Thanks
    78
    Thanked 2 Times in 2 Posts

    Formula Issue

    Why does this output 0?

    PHP Code:
    //Original:
    $buildtimediv[$num] = ($post*$btimes[$troop[$num]])*(($barlvl*2)/100);
    //Make it Easier For You
    $buildtimediv[$num] = (1*1018)*((2*2)/100); 
    (1*1018) = Outputs correct number
    *((2*2)/100) = Idk what happened, it always makes everything 0

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    (1*1018)*((2*2)/100)

    1018 * (4/100)

    1018 * 0.04 = 40.72





    --------------------
    Leonard Whistler

  • #3
    Regular Coder
    Join Date
    Jun 2009
    Posts
    278
    Thanks
    78
    Thanked 2 Times in 2 Posts
    Ya, but it comes out as 0 :/
    it must be something wrong with the $barlvl

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    I would echo all variables - such as $barlvl - to check the values.




    ------------
    Leonard Whistler

  • Users who have thanked Len Whistler for this post:

    Ndogg (02-28-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •