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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:54:45+00:00 2026-06-18T05:54:45+00:00

Suppose i have a variable which carry a string, something like this: $data=Fusce massa

  • 0

Suppose i have a variable which carry a string, something like this:

$data="Fusce massa leo, pharetra sit amet tempus vitae, gravida nec est. Suspendisse at commodo sapien. Duis purus tortor, porttitor nec viverra ut, tempus at justo. Curabitur aliquam, odio non rhoncus aliquet, nulla felis laoreet lacus, sit amet facilisis nunc orci nec erat. Sed interdum, tellus in venenatis vehicula, tortor mauris gravida nisl, eget elementum tortor libero vulputate urna. Nullam euismod porta quam eu imperdiet. Aenean sit amet mauris mauris, id facilisis lectus. Cras sed diam ut nisl imperdiet mattis non a lorem. Nullam iaculis, est id vulputate dictum, odio odio elementum neque, vestibulum dapibus urna nibh vitae lectus. In hac habitasse platea dictumst. Maecenas hendrerit aliquet erat, sit amet tincidunt mauris pulvinar a. Vestibulum porta nulla ut nulla sodales mattis. Curabitur congue, metus sit amet commodo aliquam, eros elit semper nisl, a imperdiet quam diam id neque.

Nam at urna non lorem varius ultricies. Nullam nec pellentesque justo. Nulla lobortis rhoncus enim, vitae blandit augue malesuada sed. Etiam enim risus, volutpat at malesuada ac, placerat sit amet ante. Nam faucibus quam a nunc interdum ultrices. Vivamus eleifend lacus et dui rhoncus semper. Curabitur tempor velit ut mi luctus a feugiat neque feugiat. Proin condimentum aliquam placerat. In non tortor sed tortor interdum aliquam non tempus purus. Aenean rhoncus lobortis eros, ac gravida justo porta ut. Etiam ullamcorper ante sit amet eros lacinia pulvinar vitae non orci. Curabitur orci massa, ultricies id sodales eu, congue vel lectus. Cras a scelerisque nisl. Nulla ornare ultrices nisl, non viverra quam ornare quis.
Aenean non libero non ante cursus ultricies. Morbi tincidunt volutpat diam, quis interdum dolor tempus sed. Sed accumsan auctor est vel imperdiet. Proin auctor congue risus in pharetra. Ut faucibus luctus diam, at vehicula justo pulvinar id. Aliquam ipsum augue, hendrerit ultrices dapibus eu, hendrerit in tellus. Phasellus accumsan, ante eget sodales venenatis, nisl nibh pellentesque odio, a sodales mi eros eu ante. Phasellus a ipsum erat.";

Now i want to use a array and divide the data that comes from the variable $data to: $mdata[0], $mdata[1] $mdata[2] $mdata[3], $mdata[4] $mdata[5] $mdata[6], $mdata[7] $mdata[8] $mdata[9] thoroughly from top to bottom in an equal parentage of data comes from the variable $data.
For example: $mdata[0] will contain
Fusce massa leo, pharetra sit amet tempus vitae, gravida nec est. Suspendisse at commodo sapien. Duis purus tortor
And continuously for other variables of that array … Any idea?

  • 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-18T05:54:46+00:00Added an answer on June 18, 2026 at 5:54 am

    Get the length of the string, divide length by 10 and str_split it if you want each array item to contain an equal number of characters.

    $length = strlen($data);
    $mdata  = str_split($data, $length / 10);
    

    If you want each array item to contain an equal number of words, not characters, this should work:

    $words = explode(' ', $data);
    $wseg  = floor(count($words) / 10);
    $mdata = array();
    
    for ($i = 0; $i < 9; $i++) {
        $mdata[$i] = implode(' ', array_slice($words, $wseg * $i, $wseg));
    }
    
    $mdata[$i] = implode(' ', array_slice($words, $wseg * $i));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a text variable $$string . How can I write a boolean
Suppose that I have an integer variable in a class, and this variable may
Suppose we have a variable k which is equal 7: int k=7; int t=&k;
Suppose I have a class Base which has a member variable A* my_hash. I
Suppose I have a SAS dataset that looks like this: id x 1 1234
Suppose I have a function: function test(){ //should I define global variable here //like
This should be a fundamental C# question. Suppose I have a Person class which
suppose i have a variable int a=512 Now when i apply ~a which means
i have a pointer or variable which stores the address like 0xb72b218 now i
Suppose I have an shared library file (say libtemp.so) which has a global variable.

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.