Discord PHP bot. I'm trying to split a 13,000 character string into multiple strings of 2,000 characters

Basically - a command returns 13,000+ characters. I’m trying to limit it to 2,000, but can’t figure out how. The logs and code is posted below!

                            if(strlen($pets) > 2000) {
                                $Length = strlen($pets);
                                $AfterLength = $Length / 2000;
                                $FinalLength = ceil($AfterLength);
                                for ($i = 1; $i <= $FinalLength; $i++) {
                                    $Length = strlen($pets) + strlen("Pets for `{$UserID}` (Page: {$i}\n\n");
                                    $extraAccountLength = strlen("Pets for `{$UserID}` (Page: {$i}\n\n");
                                    $subbedMessage = substr($pets, ($i * 2000), (($i * 2000) - $extraAccountLength) + 2000);
                                    $SubLength = strlen($subbedMessage);
                                    $MathResolution1 = ($i * 2000);
                                    $MathResolution2 = (($i * 2000) - $extraAccountLength) + 2000;
                                    BotLog("Subbed message length: {$SubLength}. Math Resolution 1 - 2: {$MathResolution1} - {$MathResolution2}. Pet Length: {$Length}.");
                                }

Do you mean something like this (I haven’t tested it)?

$strs = []
for ($i = 0; $i < str(len($str); $i += 2000) {
    array_push($strs, substr($str, i, 2000)
}

Basically … I figured it out now. PHP has an amazing function that splits it into an array for you. But your method worked aswell. What a legend man haha!