|
-
Jan 9th, 2008, 02:26 AM
#1
Thread Starter
Fanatic Member
decrease count
hi,
i need help how to decrease by 1 in Number for example 100 - 1 = 99
my code in php:
PHP Code:
$credits=count($credits)-1;
is this correct? assuming $credits got 100 then -1 so 99 and so on...
regards,
-
Jan 9th, 2008, 02:50 AM
#2
Thread Starter
Fanatic Member
Re: decrease count
thanks...
solve it my problem 
regards
-
Jan 9th, 2008, 03:01 AM
#3
Re: decrease count
Count returns the number of elements in an array. Normal arithmetic will help you here:
Code:
$credits = $credits -1;
//shorter way
$credits -= 1;
-
Jan 9th, 2008, 04:52 AM
#4
Thread Starter
Fanatic Member
Re: decrease count
 Originally Posted by visualAd
Count returns the number of elements in an array. Normal arithmetic will help you here:
Code:
$credits = $credits -1;
//shorter way
$credits -= 1;
Thanks.
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,
-
Jan 9th, 2008, 06:40 AM
#5
Re: decrease count
You need to use an if statement.
-
Jan 9th, 2008, 07:44 AM
#6
Thread Starter
Fanatic Member
Re: decrease count
 Originally Posted by visualAd
You need to use an if statement.
thanks work now
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|