note 81944 added to function.str-pad
| From: | bxi at apparoat dot nl | Date: | Thu, 20 Mar 2008 14:17:20 +0000 |
| Subject: | note 81944 added to function.str-pad | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137235@lists.php.net to get a copy of this message | ||
In case you want to pad 2 strings together with a character you can use:
<?php
function pad_between_strings($string1, $string2, $length, $char = " ") {
$fill_length = $length - ( strlen($string1) + strlen($string2) );
return $string1 . str_repeat($char, $fill_length) . $string2;
}
?>
----
Server IP: 83.137.20.135
Probable Submitter: 212.203.31.1
----
Manual Page -- http://www.php.net/manual/en/function.str-pad.php
Edit -- https://master.php.net/note/edit/81944
Del: integrated -- https://master.php.net/note/delete/81944/integrated
Del: useless -- https://master.php.net/note/delete/81944/useless
Del: bad code -- https://master.php.net/note/delete/81944/bad+code
Del: spam -- https://master.php.net/note/delete/81944/spam
Del: non-english -- https://master.php.net/note/delete/81944/non-english
Del: in docs -- https://master.php.net/note/delete/81944/in+docs
Del: other reasons-- https://master.php.net/note/delete/81944
Reject -- https://master.php.net/note/reject/81944
Search -- https://master.php.net/manage/user-notes.php