note 28934 deleted from function.str-pad by maxim
| From: | maxim@php.net | Date: | Tue, 28 Jan 2003 15:45:39 +0000 |
| Subject: | note 28934 deleted from function.str-pad by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42934@lists.php.net to get a copy of this message | ||
Maybe you know from other languages (like basic), that you can add a string to another string like
this:
$string = $string + $string2;
This won't work in php! You could use STR_PAD to add a string to another string.
$chars_string1 = strlen($string1);
$chars_string2 = strlen($string2);
$chars = $chars_string1 + $chars_string2;
$string1 = str_pad($string1, $chars, $string2, STR_PAD_RIGHT);
BUT!!!!!!! There's a so much easier way to do the same:
$string1 = "blub"; $string2 = "blab";
$string1 = "".$string1." ".$string2."";
print $string1;
This would print out "blub blab"!!