<?php
$string = '012345678901234567890123456789012345678901234567890123456789';
$splitAtPoints = [1, 18, 32, 41, 108, 125, 137, 152, 161];
preg_match(
sprintf(
'/%s/us',
implode(
array_map(
fn($quantifier) => "(.{{$quantifier}})?",
$splitAtPoints
)
)
),
$string,
$match
);
array_shift($match);
var_export($match);
preferences:
24.29 ms | 409 KiB | 5 Q