<?php

error_reporting(-1);
mb_internal_encoding('UTF-8');

$employees = ['pu9me1', 'pu3me2', 'pu2an3', 'pu2ma1', 'pu1me2boss'];
$regexp = '/([a-z]{2})([0-9]*)([a-z]{2})([1-3])(boss)?/';
$i = 0;
$x = 0;
$employeesOfPurchaseDepartment = [];
$matches = [];

foreach ($employees as $key => $employee) {
    preg_match($regexp, $employee, $matches[$i]);
    $bossStatus = false;
    if (isset($matches[$i][5])) {
        $bossStatus = true;
    }
    $numberOfEmployees = (int)$matches[$i][2] + $x;
    for ($x; $x < $numberOfEmployees; $x++) {
        $employeesOfPurchaseDepartment[$x] = $matches[$i][1] . $matches[$i][3] . $bossStatus . $matches[$i][4] . 400;
    }
    $i++;
}

var_dump($employeesOfPurchaseDepartment);