<?php
$input = "Alien";
echo str_pad($input, 10); // produces "Alien "
echo str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien"
echo str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___"
echo str_pad($input, 6, "___"); // produces "Alien_"
echo str_pad($input, 3, "*"); // produces "Alien"
?>
$number = 12;
$width = 4;
$padded = str_pad((string)$number, $width, "0", STR_PAD_LEFT);
$bilangan=1234; // Nilai Proses
$fzeropadded = sprintf("%07d", $bilangan);
echo "$fzeropadded "; // Hasil 0001234