1 2 3 4 5 6 7 8 9 10
<?php $string = " Some string "; $output = preg_replace_callback("/^\s+|\s+$/","uScores",$string); echo $output; function uScores($matches) { return str_repeat("_",strlen($matches[0])); } ?>
1
_Some string_______