PHP $ _GET难度大

I'm having difficulty with a homework assignment using PHP.

    <?php
        if (!isset($_GET['board'])){
            echo "Board value not set";
        }else{
        $position = filter_input(INPUT_GET ,'board');
        $squares = str_split($postion);

    echo $squares[0].'<br/>';
    echo $squares[1].'<br/>';
    echo $squares[2].'<br/>';
    echo $squares[3].'<br/>';
    echo $squares[4].'<br/>';
    echo $squares[5].'<br/>';
    echo $squares[6].'<br/>';
    echo $squares[7].'<br/>';
    echo $squares[8] .'<br/>';

    if (winner('x',$squares)){
        echo 'You win.';
    }elseif(winner('o', $squares)){
        echo 'I win.';
    }else{
        echo 'No winner yet.';
    }
}
function winner($token, $squares){
    $won = false;
    if(($squares[0] === $token) && ($squares[1] === $token) && ($squares[2] === $token)){
        $won = true;
    }elseif(($squares[0] === $token) &&($squares[3] === $token) && ($squares[6] === $token)){
        $won = true;
    }elseif(($squares[0] === $token) &&($squares[4] === $token) && ($squares[8] === $token)){
        $won = true;
    }elseif(($squares[1] === $token) &&($squares[4] === $token) && ($squares[7] === $token)){
        $won = true;
    }elseif(($squares[2] === $token) &&($squares[4] === $token) && ($squares[6] === $token)){
        $won = true;
    }elseif(($squares[2] === $token) &&($squares[5] === $token) && ($squares[8] === $token)){
        $won = true;
    }elseif(($squares[3] === $token) &&($squares[4] === $token) && ($squares[5] === $token)){
        $won = true;
    }elseif(($squares[6] === $token) &&($squares[7] === $token) && ($squares[8] === $token)){
        $won = true;
    }
    return $won;
}
?>

This is the PHP I'm using. My problem comes when I enter the url and follow it with ?board=xxx---ooo the str_split method isn't storing anything in the squares[]. It recognizes that there is 'board' because the !isset gets triggered but it doesn't pass the characters through so my echo prints 8 returns, and my winner function can't evaluate properly.

I feel like I'm missing something minor here and just can't see it.

You have a typo, change :

$squares = str_split($postion); 

To :

$squares = str_split($position);

Please change the following line:

$position = filter_input(INPUT_GET ,'board');

with

$position = $_GET['board'];

and care about your variable name spelling.

You missed an 'i' in your naming.

It could resolve your problem, I think.