How to add spaces at the beginning and end of a string in PHP

1 Answer

0 votes
$s = "php java python c++";
    
$s = ' ' . $s . ' ';

echo $s;


/*
run: 

" php java python c++ "

*/

 



answered Nov 15, 2017 by avibootz

Related questions

1 answer 153 views
1 answer 154 views
1 answer 193 views
1 answer 161 views
1 answer 125 views
1 answer 164 views
...