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 6165005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:05:23+00:00 2026-05-23T22:05:23+00:00

The idea is to take a string and slip it up in to 2048

  • 0

The idea is to take a string and slip it up in to 2048 bytes.

So if i have a 5000 byte string. data.php returns how many chucks being 1 or more. data.php?chunk=1 returns the first 2048 bytes, chunk=2 returns the next 2048 bytes and chunk=3 returns the remaining 904 byes.

I’m not really sure how you would split it up by bytes.

Or is 1 character 1 byte?

I’m working with lsl which only allows 2048 bytes per request, that’s why i have to break it into chunks.

  • 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-05-23T22:05:24+00:00Added an answer on May 23, 2026 at 10:05 pm

    If the string is based on standard ASCII characters you can use simply use

    $chunks = str_split($string , 2048);
    

    As each character uses 1 byte , you essentially have 2048 characters covering 2048 bytes.

    If you don’t want to do that you can also do it like this:

    $chunk_needed = (int) $_GET['chunk'];
    $start_at = ($chunk_needed * 2048 ) - 2048 ;
    echo substr($string , $start_at , 2048);
    

    Edit:

    My apologies, I misread 2048 bytes as 2048 bits and ended up calculating 256 characters. It was incorrect, as each character takes one byte, with 2048 bytes you have 2048 characters. I have fixed the codes above.

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

Sidebar

Related Questions

Idea: I want to make smth like real time electronic blackboard. Many users have
I have a localized string which needs to take a few variables. However, in
I have a piece of code which allows me to take a single string
The basic idea is to take a string and evaluate it against an XML
This is probably crazy. I want to take the idea of Dependency Injection to
any idea how if the following is possible in PHP as a single line
So, the idea is that I would take the following code used to run
Take the following example, preg_match_all(/(^|-)[a-z]+(-|$)/i, foo-bar-moo, $matches); This (correctly) returns the following matches, foo-
I have a MyFunction that may take several datatypes, which are all very similar.
I have a class that has two functions, both of which take a different

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.