fork(4) download
  1. <?php
  2.  
  3. $sObject = 's:100:"word";';
  4. $res = preg_replace_callback('!s:(\d+):"(.*?)";!', function($m) {
  5. return 's:' . strlen($m[2]) . ':"' . $m[2] . '";';
  6. }, $sObject);
  7. echo $res;
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
s:4:"word";