- microtime: documentation ( source)
- var_export: documentation ( source)
- preg_replace: documentation ( source)
- rand: documentation ( source)
- md5: documentation ( source)
<?php
$r = md5(rand().microtime(TRUE));
$_POST = [
$r => 'theSubmittedUsername',
'__autocomplete_fix_' . $r => 'username'
];
foreach ($_POST as $key => $val) {
$newKey = preg_replace('~^__autocomplete_fix_~', '', $key, 1, $count);
if ($count) {
$_POST[$val] = $_POST[$newKey];
unset($_POST[$key], $_POST[$newKey]);
}
}
var_export($_POST);