未初始化的字符串偏移错误处理

I have a variable name $accountNumber which holds a 9 digit number. When a user types it in and when it is displayed, it is cut up in 9 separate box's.

Like so: how the account number is displayed

When getting the account number I do something like this:

//$data['acountNumber'] = 453554334;

$accountNumber = (string)$data['accountNumber'];
$accountNumber_0 = $accountNumber[0];
$accountNumber_1 = $accountNumber[1];
$accountNumber_2 = $accountNumber[2];
$accountNumber_3 = $accountNumber[3];
$accountNumber_4 = $accountNumber[4];
$accountNumber_5 = $accountNumber[5];
$accountNumber_6 = $accountNumber[6];
$accountNumber_7 = $accountNumber[7];
$accountNumber_8 = $accountNumber[8];

However, if I don't have an account number listed, I get an Uninitialized string offset error. I can make this "go away" if I add an @ in font of each $accountNumber[#] but I thought I would ask you guys if there is a better way at handling this.

What do you think?

EDIT - After accepted answer

The below answers work great. But since I needed to have my array be size 9 no matter what, I found that this works best.

$accountNumber = array_pad(str_split($data['accountNumber']), 9, '');

You have not converted the string to array. str_split would do that for you.

This should work for you:

<?php

$data['acountNumber'] = 453554334;
$data['acountNumber'] = strval($data['acountNumber']); // converts numbers to string

$accountNumber = str_split($data['acountNumber']); // split the string to array
$accountNumber_0 = $accountNumber[0];
$accountNumber_1 = $accountNumber[1];
$accountNumber_2 = $accountNumber[2];
$accountNumber_3 = $accountNumber[3];
$accountNumber_4 = $accountNumber[4];
$accountNumber_5 = $accountNumber[5];
$accountNumber_6 = $accountNumber[6];
$accountNumber_7 = $accountNumber[7];
$accountNumber_8 = $accountNumber[8];

Here is a PHP Fiddle that shows it in action.

//Cast your string
$accountNumber = (string)$data['accountNumber'];
//Get the length of the string
$length = strlen ($accountNumber);
//Create an empty array containing the account numbers
$accountNumberArr = array();
//Start the loop
for($i = 0; $i < $length; $i++){
    //Add the account numbers to the account number array
    $accountNumberArr['accountNumber_'.$i] = $accountNumber[$i];
}

//Now you can access your account number as follows
// $accountNumberArr['accountNumber_0'], $accountNumberArr['accountNumber_1'];