Function __global->str_pad

Definitions

sources_custom/phpstub.php

  • Pad a string to a certain length with another string.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$input string No No required parameter N/A N/A The subject
$pad_length integer No No required parameter N/A N/A The length to pad up to
$pad_string string No No N/A N/A What we are padding with
$pad_type integer No No 1 N/A N/A The padding type (STR_PAD_RIGHT, STR_PAD_LEFT, STR_PAD_BOTH)

Returns

  • The result
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Pad a string to a certain length with another string.
 *
 * @param  string $input The subject
 * @param  integer $pad_length The length to pad up to
 * @param  string $pad_string What we are padding with
 * @param  integer $pad_type The padding type (STR_PAD_RIGHT, STR_PAD_LEFT, STR_PAD_BOTH)
 * @return string The result
 */

function str_pad(string $input, int $pad_length, string $pad_string = ' ', int $pad_type = 1) : string