Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $result = [];
- $inBlock = false;
- $block = [];
- for ($i = 0; $i < count($array); $i++) {
- $current = $array[$i];
- if ($inBlock) {
- $valid = false;
- foreach ($payloads as $payload) {
- if (strpos($current, $payload) === 0) {
- $valid = true;
- }
- }
- if ($valid) {
- $block[] = $current;
- } elseif ($current === $end) {
- $result = array_merge($result, $block, ['|']);
- }
- $inBlock = $valid;
- } elseif (strpos($current, $start) === 0) {
- $block = [$current];
- $inBlock = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement