List of variables, split based on pattern In my application i keep repeating writing this pattern. I just cant figure out how to write it better. Coming to you for suggestions:

        if ($_POST['x'] = 1) {add_remove($one, array($two,$three,$four,$five));}
        if ($_POST['x'] = 2) {add_remove($two, array($one,$three,$four,$five));}
        if ($_POST['x'] = 3) {add_remove($three, array($one,$two,$four,$five));}
        if ($_POST['x'] = 4) {add_remove($four, array($one,$two,$three,$five));}
        if ($_POST['x'] = 5) {add_remove($five, array($one,$two,$three,$four));}
You can extract the value from the array before hand with something like:

$arr = array($one, $two,$three,$four,$five);

&amp;first = $arr[$_POST['x']-1];

unset($arr[$_POST['x']-1]);
$arr = array_values($arr);
add_remove($first, $arr);