Skip to content

Instantly share code, notes, and snippets.

@kaskad88
Created January 6, 2023 11:25
Show Gist options
  • Save kaskad88/c14c0d756c51d20ee0ee3c060f9f2deb to your computer and use it in GitHub Desktop.
Save kaskad88/c14c0d756c51d20ee0ee3c060f9f2deb to your computer and use it in GitHub Desktop.
Recalculating the length of the elements in serialized array
$data = preg_replace_callback('!s:\d+:"(.*?)";!s',
function($m) {
return "s:" . strlen($m[1]) . ':"'.$m[1].'";';
}, $data
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment