I want to generate specific characters string. I need to generate exact 35 characters string for that I am using this function.
var_dump(str_pad("some text some text", 35, " ", STR_PAD_RIGHT));
So, it's giving me this output:
string(35) "some text some text "
That's exactly fine. It'll add blank spaces for remaining characters.
But, For this type of scenario, I want to discard characters above 35.
var_dump(str_pad("some text some text some text some text some text some text some text some text", 35, " ", STR_PAD_RIGHT));
Current Output:
string(79) "some text some text some text some text some text some text some text some text"
I need it 35 characters here as well by discarding last few characters from string.