How can you customize the padding character in str_pad() to be a space instead of an underscore in PHP?

To customize the padding character in str_pad() to be a space instead of an underscore in PHP, you can simply pass the desired padding character as the third argument in the function call. By default, str_pad() uses an underscore as the padding character. However, you can specify a different character, such as a space, by providing it as the third argument.

// Customizing padding character to be a space instead of an underscore
$originalString = "Hello";
$paddedString = str_pad($originalString, 10, " ", STR_PAD_RIGHT);

echo $paddedString; // Outputs: "Hello     "