Skip to content

Instantly share code, notes, and snippets.

@shin1x1
Created January 29, 2022 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shin1x1/701278a17fe0aaf03a69678c31e4bfc7 to your computer and use it in GitHub Desktop.
Save shin1x1/701278a17fe0aaf03a69678c31e4bfc7 to your computer and use it in GitHub Desktop.
<?php
$string = str_repeat(' ', 200000) . 'a';
$start = microtime(true);
preg_replace('/\s+$/', '', $string);
if (preg_last_error() !== 0) {
var_dump(preg_last_error_msg());
}
echo microtime(true) - $start, PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment