Show Output
Format Strings Using sprintf()
", $str1); // Standard string output echo sprintf("[%10s]
", $str1); // Right-justifies the string with spaces echo sprintf("[%-10s]
", $str1); // Left-justifies the string value with spaces echo sprintf("[%010s]
", $str1); // Left-pads string with zeros. echo sprintf("[%-010s]
", $str1); // Right-pads string with zeros echo sprintf("[%'#10s]
", $str1); // Left-pads string with '#' character echo sprintf("[%.10s]
", $str2); // Cuts off string after 10 characters ?>