★ wanayoo — archive 1999 http://www.php.net/manual/hu/function.str-pad.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Stringek
Quick Reference
English version of this pageGerman version of this pageJapanese version of this page
Stringek
* AddCSlashes
* AddSlashes
* bin2hex
* Chop
* Chr
* chunk_split
* convert_cyr_string
* count_chars
* crypt
* echo
* explode
* flush
* get_html_translation_table
* get_meta_tags
* htmlentities
* htmlspecialchars
* implode
* join
* levenshtein
* ltrim
* md5
* Metaphone
* nl2br
* ob_start
* ob_get_contents
* ob_end_flush
* ob_end_clean
* ob_implicit_flush
* Ord
* parse_str
* print
* printf
* quoted_printable_decode
* quotemeta
* rtrim
* setlocale
* similar_text
* soundex
* sprintf
* strcasecmp
* strchr
* strcmp
* strcspn
* strip_tags
* stripcslashes
* stripslashes
* stristr
* strlen
* str_pad
* strpos
* strrchr
* str_repeat
* strrev
* strrpos
* strspn
* strstr
* strtok
* strtolower
* strtoupper
* str_replace
* strtr
* substr
* substr_count
* substr_replace
* trim
* ucfirst
* ucwords
Manual: str_pad
View the source code for this pageSearch the site



Previous page
 strlen
 Updated
Sat, 12 Aug 2000
strpos 
Next page


str_pad

(PHP4 >= 4.0.1)

str_pad -- Pad a string to a certain length with another string

Description

string str_pad (string input, int pad_length [, string pad_string [, int pad_type]])

This functions pads the input string on the left, the right, or both sides to the specifed padding length. If the optional argument pad_string is not supplied, the input is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.

Optional argument pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If pad_type is not specified it is assumed to be STR_PAD_RIGHT.

If the value of pad_length is negative or less than the length of the input string, no padding takes place.

Példa 1. str_pad() example


$input = "Alien";
print str_pad($input, 10);                      // produces "Alien     "
print str_pad($input, 10, "-=", STR_PAD_LEFT);  // produces "-=-=-Alien"
print str_pad($input, 10, "_", STR_PAD_BOTH);   // produces "__Alien___"
      


User Contributed Notes: str_pad


billn@gct-us.com
12-Aug-2000 05:34
str_pad does not accept optional fourth parameter. Adding STR_PAD_LEFT causes
Warning: Wrong parameter count for str_pad() error



bn@parts-unknown.com
15-Aug-2000 08:48
Eek! When will the parameter count issue be fixed?


 About Notes


Previous page
 strlen
 Updated
Sat, 12 Aug 2000
strpos 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.