search

Home  >  Q&A  >  body text

How does php return a value of 000001 instead of 1?

EG: Fixed 6-digit length, 000001, 000002, 000003,......

Increase in turn.

phpcn_u1582phpcn_u15822752 days ago593

reply all(4)I'll reply

  • 仅有的幸福

    仅有的幸福2017-06-23 09:13:36

    str_pad($number, 6, '0', STR_PAD_LEFT);

    reply
    0
  • typecho

    typecho2017-06-23 09:13:36

    sprintf("%06d", $num);

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-23 09:13:36

        echo sprintf("%'06d\n", 1);

    reply
    0
  • 天蓬老师

    天蓬老师2017-06-23 09:13:36

    sprintf("%06d", $num);

    reply
    0
  • Cancelreply