note 48314 added to control-structures.for
| From: | marcel dot a dot n at bol dot com dot br | Date: | Sat, 18 Dec 2004 23:37:44 +0000 |
| Subject: | note 48314 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82004@lists.php.net to get a copy of this message | ||
I'm tring to find a way to completee a list of numbers with "0", but I cant do this.
Let me show:
http://www.php.net/image07.jpg
http://www.php.net/image08.jpg
http://www.php.net/image09.jpg
http://www.php.net/image10.jpg
http://www.php.net/image11.jpg
http://www.php.net/image12.jpg
http://www.php.net/image13.jpg
In that case I used:
for( $ct1=1 ; $ct1 <= $_POST['variavel1'] ; $ct1++ ) {
if ( isset($_POST['zero1']) )
if ( $ct1 < 10 ) {
$zero1 = "0";
} else {
$zero1 = "";
}
This way it completes with "0" when the number > 99. I'm tring to find a way to
complete set the numbers for 5 cases and it be autocompleted with zeros. Like:
Number of cases: 5
Count until: 2000
0001
0002
...
0010
0011
...
0100
0101
....
1000
1002
...
2000
Does anyone have any idea?
----
Manual Page -- http://www.php.net/manual/en/control-structures.for.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48314
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48314&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48314&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48314&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48314&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48314&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48314&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48314&report=yes
Search -- http://master.php.net/manage/user-notes.php