0

I have a personal id like below:

$personal_id = 'I91120056N';
$verify = array_merge(array_fill(0, 1, 'W'), array_combine(range(1, 22),range('A','V'))); #0-22 #A-W 0=W
$splitID = str_split($personal_id,1);
$firstletter = array_search($splitID[0], $verify);

I'm splitting the id into an array that looks like :

$splitID = Array
(
    [0] => I
    [1] => 9
    [2] => 1
    [3] => 1
    [4] => 2
    [5] => 0
    [6] => 0
    [7] => 5
    [8] => 6
    [9] => N
)

Now I want to replace the I with a number that $firstletter gives and merge it into the same array.

0

1 Answer 1

1

If i understood your question correctly this should solve your problem: $arr[0] = $firstletter; $output = implode(',',$arr)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.