Hướng dẫn 01 to 1 php - 01 và 1 php

Tôi đang cố gắng tạo số hóa đơn. Chúng phải luôn luôn là 4 số dài, ví dụ: với số 0 hàng đầu: ví dụ:

  • 1 -> Hóa đơn 0001
  • 10 -> Hóa đơn 0010
  • 150 -> Hóa đơn 0150

etc.

hỏi ngày 9 tháng 6 năm 2011 lúc 17:25Jun 9, 2011 at 17:25

1

Sử dụng str_pad ().

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);

Đã trả lời ngày 9 tháng 6 năm 2011 lúc 17:27Jun 9, 2011 at 17:27

WiseGuywiseGuyWiseguy

Huy hiệu vàng 20k8 64 Huy hiệu bạc79 Huy hiệu đồng8 gold badges64 silver badges79 bronze badges

12

Sử dụng sprintf: http://php.net/function.sprintf

$number = 51;
$number = sprintf('%04d',$number);
print $number;
// outputs 0051


$number = 8051;
$number = sprintf('%04d',$number);
print $number;
// outputs 8051

Đã trả lời ngày 9 tháng 6 năm 2011 lúc 17:29Jun 9, 2011 at 17:29

Chris Bakerchris BakerChris Baker

48.8K12 Huy hiệu vàng98 Huy hiệu bạc115 Huy hiệu đồng12 gold badges98 silver badges115 bronze badges

3

Sử dụng (s) ________ 9

printf('%04d',$number);

Đã trả lời ngày 9 tháng 6 năm 2011 lúc 17:27Jun 9, 2011 at 17:27

WiseGuywiseGuyWrikken

Huy hiệu vàng 20k8 64 Huy hiệu bạc79 Huy hiệu đồng8 gold badges93 silver badges135 bronze badges

Sử dụng sprintf: http://php.net/function.sprintf

$x = 1;
sprintf("%03d",$x);
echo $x;

Đã trả lời ngày 9 tháng 6 năm 2011 lúc 17:29Jun 9, 2011 at 17:28

Hướng dẫn 01 to 1 php - 01 và 1 php

Chris Bakerchris BakerDave

48.8K12 Huy hiệu vàng98 Huy hiệu bạc115 Huy hiệu đồng21 gold badges111 silver badges178 bronze badges

Sử dụng (s) ________ 94.

/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001

WrikkenWrikkenJun 9, 2011 at 21:48

webjawns.comwebjawns.comwebjawns.com

67.6K8 Huy hiệu vàng93 Huy hiệu bạc135 Huy hiệu Đồng2 gold badges14 silver badges34 bronze badges

Thử cái này:str_pad function

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)

Đã trả lời ngày 9 tháng 6 năm 2011 lúc 17:28

DavedaveSep 7, 2018 at 11:22

28.4K21 Huy hiệu vàng111 Huy hiệu bạc178 Huy hiệu đồngSani Kamal

printf('%04d',$number);
0 hoạt động tốt nếu bạn luôn in một cái gì đó, nhưng
printf('%04d',$number);
1 mang lại cho bạn sự linh hoạt hơn. Nếu bạn sử dụng chức năng này,
printf('%04d',$number);
2 sẽ là 4.14 silver badges25 bronze badges

1

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;

Đã trả lời ngày 9 tháng 6 năm 2011 lúc 21:48

2.2802 Huy hiệu vàng14 Huy hiệu bạc34 Huy hiệu đồng17 gold badges156 silver badges321 bronze badges

Sử dụng chức năng STR_PADJun 9, 2011 at 17:30

1

$ num là số của bạn

Rustamabd@gmail-you-know-what ¶int is a number of the set ℤ = {..., -2, -1, 0, 1, 2, ...}.

Litbai ¶

  • 6 năm trước
  • Ẩn danh ¶
  • 7 năm trước

18 năm trước

Darkshire ¶s can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation. The negation operator can be used to denote a negative int.

14 năm trước

Jacek ¶

Eric ¶

printf('%04d',$number);
9

pere dot cil tại wanadoo dot fr ¶int literals is as of PHP 7.4.0 (previously, underscores have not been allowed):

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary

11 năm trướcint is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits signed). 64-bit platforms usually have a maximum value of about 9E18. PHP does not support unsigned ints. int size can be determined using the constant

$x = 1;
sprintf("%03d",$x);
echo $x;
0, maximum value using the constant
$x = 1;
sprintf("%03d",$x);
echo $x;
1
, and minimum value using the constant
$x = 1;
sprintf("%03d",$x);
echo $x;
2
.

WBCarts tại Juno Dot Com ¶

13453814063 tại 163 dot com ¶int type, it will be interpreted as a float instead. Also, an operation which results in a number beyond the bounds of the int type will return a float instead.

Dewi tại Dewimorgan dot com

$x = 1;
sprintf("%03d",$x);
echo $x;
3

JMW254 tại Cornell Dot Edu ¶

$x = 1;
sprintf("%03d",$x);
echo $x;
4

16 năm trướcint division operator in PHP, to achieve this use the intdiv() function.

$x = 1;
sprintf("%03d",$x);
echo $x;
5 yields the float
$x = 1;
sprintf("%03d",$x);
echo $x;
6. The value can be cast to an int to round it towards zero, or the round() function provides finer control over rounding.

$x = 1;
sprintf("%03d",$x);
echo $x;
7

Chuyển đổi sang số nguyên

Để chuyển đổi một cách rõ ràng một giá trị thành int, hãy sử dụng các diễn viên

$x = 1;
sprintf("%03d",$x);
echo $x;
8 hoặc
$x = 1;
sprintf("%03d",$x);
echo $x;
9. Tuy nhiên, trong hầu hết các trường hợp, diễn viên không cần thiết, vì giá trị sẽ được tự động chuyển đổi nếu toán tử, hàm hoặc cấu trúc điều khiển yêu cầu đối số INT. Một giá trị cũng có thể được chuyển đổi thành int với hàm intval ().int, use either the
$x = 1;
sprintf("%03d",$x);
echo $x;
8 or
$x = 1;
sprintf("%03d",$x);
echo $x;
9 casts. However, in most cases the cast is not needed, since a value will be automatically converted if an operator, function or control structure requires an int argument. A value can also be converted to int with the intval() function.

Nếu một tài nguyên được chuyển đổi thành INT, thì kết quả sẽ là số tài nguyên duy nhất được gán cho tài nguyên bằng PHP khi chạy.resource is converted to an int, then the result will be the unique resource number assigned to the resource by PHP at runtime.

Xem thêm Loại tung hứng.

Từ booleans

/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
0 sẽ mang lại
printf('%04d',$number);
3 (không) và
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
2 sẽ mang lại
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
3 (một).
will yield
printf('%04d',$number);
3 (zero), and
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
2
will yield
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
3 (one).

Từ số điểm nổi

Khi chuyển đổi từ phao sang INT, số sẽ được làm tròn về 0. Kể từ Php 8.1.0, một thông báo từ chối được phát ra khi ngầm chuyển đổi một chiếc phao không tích phân sang INT mất độ chính xác.float to int, the number will be rounded towards zero. As of PHP 8.1.0, a deprecation notice is emitted when implicitly converting a non-integral float to int which loses precision.

/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
4

Nếu phao vượt quá ranh giới của INT (thường là

/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
5 trên các nền tảng 32 bit và
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
6 trên các nền tảng 64 bit), kết quả không được xác định, vì phao không có đủ độ chính xác để đưa ra kết quả INT chính xác. Không có cảnh báo, thậm chí không một thông báo sẽ được đưa ra khi điều này xảy ra!int (usually
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
5 on 32-bit platforms and
/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
6 on 64-bit platforms), the result is undefined, since the float doesn't have enough precision to give an exact int result. No warning, not even a notice will be issued when this happens!

Ghi chú::

Nan và Infinity sẽ luôn bằng không khi được đúc vào Int.int.

Cảnh báo

Không bao giờ sử dụng một phần không xác định cho Int, vì điều này đôi khi có thể dẫn đến kết quả bất ngờ.int, as this can sometimes lead to unexpected results.

/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
7

Xem thêm cảnh báo về độ chính xác nổi.

Từ chuỗi

Nếu chuỗi là số hoặc số dẫn thì nó sẽ giải quyết thành giá trị số nguyên tương ứng, nếu không nó được chuyển đổi thành 0 (

printf('%04d',$number);
3).

Từ nullNULL

/**
 * Add leading zeros to a number, if necessary
 *
 * @var int $value The number to add leading zeros
 * @var int $threshold Threshold for adding leading zeros (number of digits 
 *                     that will prevent the adding of additional zeros)
 * @return string
 */
function add_leading_zero($value, $threshold = 2) {
    return sprintf('%0' . $threshold . 's', $value);
}

add_leading_zero(1);      // 01
add_leading_zero(5);      // 05
add_leading_zero(100);    // 100
add_leading_zero(1);      // 001
add_leading_zero(5, 3);   // 005
add_leading_zero(100, 3); // 100
add_leading_zero(1, 7);   // 0000001
9 luôn được chuyển đổi thành 0 (
printf('%04d',$number);
3).
is always converted to zero (
printf('%04d',$number);
3).

Từ các loại khác

Thận trọng

Hành vi chuyển đổi sang INT không được xác định cho các loại khác. Không dựa vào bất kỳ hành vi quan sát nào, vì nó có thể thay đổi mà không cần thông báo trước.int is undefined for other types. Do not rely on any observed behaviour, as it can change without notice.

PHP tại Richardneill Dot org ¶

9 năm trước

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
1

D_N tại Nospam Dot Loryx Dot Com ¶

15 năm trước

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
2

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
3

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
4

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
5

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

Dhairya lakhera ¶

4 năm trước

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
7

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
8

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
9

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
0

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
1

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
2

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
3

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
4

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
5

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
6

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
7

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

Egwayjen tại gmail dot com

4 năm trước

while ( strlen($invoice_number) < 4 ) $invoice_num = '0' . $invoice_num;
9

Egwayjen tại gmail dot com

Ganlvtech tại qq dot com ¶

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
0

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
1

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
2

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
3

2 năm trước

Ganlvtech tại qq dot com ¶

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
4

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
5

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
6

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
7

2 năm trước

15 năm trước

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
8

Dhairya lakhera ¶

4 năm trước

decimal     : [1-9][0-9]*(_[0-9]+)*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*

octal       : 0[oO]?[0-7]+(_[0-7]+)*

binary      : 0[bB][01]+(_[01]+)*

integer     : decimal
            | hexadecimal
            | octal
            | binary
9

Egwayjen tại gmail dot com

Ganlvtech tại qq dot com ¶

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);0

Egwayjen tại gmail dot com

15 năm trước

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);1

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);2

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);3

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

Egwayjen tại gmail dot com

Ganlvtech tại qq dot com ¶

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);5

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);6

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

2 năm trước

Kuzawinski Dot Marcin_Nospam tại Gmail Dot Com ¶

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);8

$invID = str_pad($invID, 4, '0', STR_PAD_LEFT);9

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

Rustamabd@gmail-you-know-what ¶

15 năm trước

sprintf1

Dhairya lakhera ¶

Kuzawinski Dot Marcin_Nospam tại Gmail Dot Com ¶

sprintf2

sprintf3

sprintf4

sprintf5

sprintf6

sprintf7

sprintf8

sprintf9

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

Rustamabd@gmail-you-know-what ¶

Litbai ¶

printf1

printf2

printf3

printf4

printf5

printf6

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

6 năm trước

Kuzawinski Dot Marcin_Nospam tại Gmail Dot Com ¶

printf8

printf9

printf('%04d',$number);
00

printf('%04d',$number);
01

Rustamabd@gmail-you-know-what ¶

4 năm trước

printf('%04d',$number);
02

Egwayjen tại gmail dot com

Ganlvtech tại qq dot com ¶

printf('%04d',$number);
03

printf('%04d',$number);
04

printf('%04d',$number);
05

printf('%04d',$number);
06

printf('%04d',$number);
07

printf('%04d',$number);
08

printf('%04d',$number);
09

printf('%04d',$number);
10

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6

2 năm trước

Kuzawinski Dot Marcin_Nospam tại Gmail Dot Com ¶

printf('%04d',$number);
12

printf('%04d',$number);
13

printf('%04d',$number);
14

printf('%04d',$number);
15

 //pad to left side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_LEFT)

//pad to right side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_RIGHT)

//pad to both side of the input
$my_val=str_pad($num, 3, '0', STR_PAD_BOTH)
6