Ver originalforeach ($_POST as $key => $value) { if (substr($key, 0, 5)=='lista') { $nombre = 'numero'.substr($key, 5); $$nombre = $value; }}