3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.7
array ( 'username' => 'theSubmittedUsername', )

preferences:
30.29 ms | 409 KiB | 5 Q