fork download
  1. <?PHP
  2. # answer: http://o...content-available-to-author-only...e.jp/qa/q7053493.html
  3.  
  4. $string = '222,1,33333
  5. 55,22aa
  6. 6
  7. test';
  8.  
  9. print $string;
  10. print "\n<br>\n";
  11.  
  12. $pattern = '([^\n,])([^\n,]+)';
  13. $replacement = '"\1".(str_repeat("?", mb_strlen("\2")))';
  14.  
  15. print mb_ereg_replace($pattern ,$replacement, $string, 'e');
  16. ?>
Success #stdin #stdout 0s 13112KB
stdin
Standard input is empty
stdout
222,1,33333
55,22aa
6
test
<br>
2??,1,3????
5?,2???
6
t???