# Declaring multiple variables with a loop?

**URL:** <https://forum.kirupa.com/t/declaring-multiple-variables-with-a-loop/305132>\
**Category:** programming\
**Created:** [February 19, 2010, 4:09pm UTC](https://forum.kirupa.com/t/declaring-multiple-variables-with-a-loop/305132 "2010-02-19T16:09:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TooRomeo](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@TooRomeo](https://forum.kirupa.com/u/TooRomeo)\
**Post date:** [February 19, 2010, 4:09pm UTC](https://forum.kirupa.com/t/declaring-multiple-variables-with-a-loop/305132/1 "2010-02-19T16:09:01Z")

</div>

I have the following variables:

```auto

$PlayerName1 = htmlspecialchars($_POST['PlayerName1']);
$PlayerName2 = htmlspecialchars($_POST['PlayerName2']);
$PlayerName3 = htmlspecialchars($_POST['PlayerName3']);
$PlayerName4 = htmlspecialchars($_POST['PlayerName4']);
$PlayerName5 = htmlspecialchars($_POST['PlayerName5']);

```

etc. all the way to PlayerName200 lol.

How would I go about declaring these same variables with a loop instead of having to repeat with copy/paste? Thanks.
