I want to like add space in sting with specified string length.
For example : Hello is my string & i set string length 30 so next string should be start after length 30 so it should be like Hello Next string
.
I would like to add space..
I have used following code but it’s not adding space it’s take whole character but not added space.
<?php $fistString ="Hello World"; $secondString ="Good"; echo str_pad($fistString, 45, ' ', STR_PAD_RIGHT).$secondString; ?>
Advertisement
Answer
I did with my self with following way..
<?php echo str_pad($string, 30, "  ", STR_PAD_RIGHT).$secondString; ?>