Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8023501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:34:53+00:00 2026-06-04T22:34:53+00:00

I have a variable called $data which contains a giant string (27338 characters). This

  • 0

I have a variable called $data which contains a giant string (27338 characters).

This string will be the content of a pdf file.

I need to add a footnote at the end of each page of the pdf file.

I’ve calculated 2642 characters per page.

How can I cut $data in chunks of 2642 characters so I can add the footnotes?

I’m trying:

$split = preg_split('/(.{0,2642})\s/',
                    $data,
                    0,
                    PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);

$count = count($split);
foreach ($split as $key => $page) {

    echo $page; echo "<br><br>";
}

But each $page shows much less than 2642 characters.

Thanks a lot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:34:55+00:00Added an answer on June 4, 2026 at 10:34 pm

    I never used it with very large amount of data but a way to split strings in elements of equal length is to use the str_split function (see http://php.net/str_split)

    usage:

    $array = str_split('some text', 2);
    

    and you will get an array with elements of length 2 (except for the last one)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP-variable called $go_Adress which contains the adress I need to get
i have this table in database which called data and i want make this
Say you have a variable called hotelPropertyNumber . The contents will always be a
I have a variable called $tags , which just references from a database field.
I have a php file which is called every X second in ajax to
I have a variable called $result which should store all the results from my
I have a table called users which currently contains column money of type integer
in a C program I have this variable: float (*data)[3]; data = (float (*)[3])calloc(ntimes,
I have a variable called $effectiveDate containing the date 2012-03-26 . I am trying
I have a variable called var in SAS/IML. I want to know how I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.