Search Results

  1. This function returns the string string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the string is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.

    • Sprintf

      Sprintf - PHP: str_pad - Manual

    • Printf

      Printf - PHP: str_pad - Manual

    • Fprintf

      Parameters ¶ stream A file system pointer resource that is...

    • Vsprintf

      Vsprintf - PHP: str_pad - Manual

    • Vfprintf

      Parameters ¶ stream format The format string is composed of...

    • Strings

      Strings Introduction ¶ These functions all manipulate...

    • Ucfirst

      Make a string's first character uppercase

    • Bin2hex

      bin2hex (PHP 4, PHP 5, PHP 7, PHP 8) bin2hex — Convert...

  2. Definition and Usage The str_pad () function pads a string to a new length.

    • Required. Specifies the string to pad
  3. Jul 11, 2025 · The str_pad () function is a built-in function in PHP and is used to pad a string to a given length. We can pad the input string by any other string up to a specified length.

  4. The str_pad() function In PHP, there is one and only one way to pad a string and that is str_pad(). At most, the function can accept four arguments. This can be seen in the syntax below:

  5. PHP str_pad Function - Learn how to use the PHP str_pad function to pad a string to a certain length with another string. Examples and syntax explained.

  6. PHP str_pad () Function Topic: PHP String Reference Prev | Next Description The str_pad() function pads a string to a certain length with another string. The following table summarizes the technical details of this function.

  7. People also ask

  8. Dec 27, 2023 · PHP str_pad () function: Here, we are going to learn about the str_pad () function with example in PHP.