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 256 views
1 answer 258 views
1 answer 327 views
1 answer 268 views
1 answer 223 views
1 answer 257 views
...