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.
If i understood your question correctly this should solve your problem: $arr[0] = $firstletter; $output = implode(',',$arr)
$arr[0] = $firstletter; $output = implode(',',$arr)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.