Help us understand the problem. What is going on with this article?

PHPで固定長文字列

More than 1 year has passed since last update.

長い文字をテストする際等に使用。

str_repeat('a', 10);
// string(10) "aaaaaaaaaa"

以下はマルチバイト対応していないのでゼロパディング等用。

str_pad('', 10, 'a', STR_PAD_LEFT);
// string(10) "aaaaaaaaaa"

str_pad('1', 10, '0', STR_PAD_LEFT);
// string(10) "0000000001"
horikeso
個人的な備忘録ばかりですが、よろしくお願いします。難しいことはよくわかりません!
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away