hi,
i need help how to decrease by 1 in Number for example 100 - 1 = 99
my code in php:
is this correct? assuming $credits got 100 then -1 so 99 and so on...PHP Code:$credits=count($credits)-1;
regards,
Printable View
hi,
i need help how to decrease by 1 in Number for example 100 - 1 = 99
my code in php:
is this correct? assuming $credits got 100 then -1 so 99 and so on...PHP Code:$credits=count($credits)-1;
regards,
thanks...
solve it my problem :D
regards
Count returns the number of elements in an array. Normal arithmetic will help you here:
Code:$credits = $credits -1;
//shorter way
$credits -= 1;
Thanks.Quote:
Originally Posted by visualAd
one question, if the credits is 0 its totally zero? since my code is still counting till -1,-2,-3,-4 i want to set the credits if 0 then 0
regards,
You need to use an if statement.
thanks work now :)Quote:
Originally Posted by visualAd