Run »
"; // String echo sprintf("[%8s]",$str1)."
"; // Right-justifies the string with spaces echo sprintf("[%-8s]",$str1)."
"; // Left-justifies the string with spaces echo sprintf("[%08s]",$str1)."
"; // Zero-padding echo sprintf("[%'*8s]",$str1)."
"; // Adds "*" echo sprintf("[%8.8s]",$str2)."
"; // Left-justifies the string with spaces (cuts off characters after the specified value) ?>
[Hello]
[ Hello]
[Hello ]
[000Hello]
[***Hello]
[Hello wo]