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 249 views
1 answer 247 views
1 answer 319 views
1 answer 263 views
1 answer 218 views
1 answer 252 views
...