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

  • Home
  • SEARCH
  • 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 6018785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:19:30+00:00 2026-05-23T03:19:30+00:00

How would i split a string every 4 characters and then have every 4

  • 0

How would i split a string every 4 characters and then have every 4 characters put into a separate variable so i can do other stuff with each individual 4 characters?

  • 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-23T03:19:31+00:00Added an answer on May 23, 2026 at 3:19 am

    Well, I don’t really see you putting each of them in a different variable, because then you’ll have like 10 variables:

    $var1 = ...;
    $var2 = ...;
    $var3 = ...;
    

    But you could use the str_split function as following:

    $variable = str_split($origionalvar, 4);

    it will create an array, which you can access:

    $variable[0] to $variable[sizeof(variable)]

    If you don’t know about arrays, you really should read up on those. They are really great if you want to store a lot of similar information in an object and you don’t want to create a new variable for it every time. Also you can loop over them very easily and do some other great stuff with them.

    I assume you probably googled this question a bit too. You must have come across http://php.net/manual/en/function.str-split.php. Did you see this page, and if you did, did you have some trouble with it. If so perhaps we can help you reading the documentation properly.

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

Sidebar

Related Questions

I have a string which I need to split into an array and then
I want a string split at every single character and put into an array.
I have a large string text file, I would like to split the string
I have a string[] array that is split by \r . Each row in
What regex pattern would need I to pass to java.lang.String.split() to split a String
How would I split a HTML formatted file into several HTML files (complete with
I have a large source repository split across multiple projects. I would like to
I have a file with data in it that I would like to split
I would like to get help and guide on how can i manipulate text/string
Using PHP, let's say I have this string: $letters = abcde; I would like

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.