LoginSignup
1
0

More than 5 years have passed since last update.

sprintfで桁指定してるときに桁あふれの数字を渡したらどうなるのか

Posted at
<?php
$num = 1;
printf('%03d', $num); // 001

$num = 1000;
printf('%03d', $num); // 1000

単純に桁あふれするだけでした。

phpのsprintfのマニュアルにも

オプションの数字。これは表示幅指定子です。 結果を(最低)何桁にするかを指定します。

と「最低何桁」かの指定って書いてありました〜

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0