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 166 views
1 answer 165 views
1 answer 198 views
1 answer 174 views
1 answer 134 views
1 answer 172 views
...