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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:26:49+00:00 2026-05-28T13:26:49+00:00

I found here many responses for my question but I cat’t find exactly what

  • 0

I found here many responses for my question but I cat’t find exactly what I am looking for.
I have to remove every 4th digit from an array, but beginning and the end making a circle, so If I remove 4th digit in next loop It’s gonna be another digit (maybe 4th maybe 3rd) It’s depend how many digit we have in string

$string = "456345673474562653265326";
$chars = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
$result = array();
for ($i = 0; $i < $size; $i += 4) 
{
    $result[] = $chars[$i];
}
  • 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-28T13:26:50+00:00Added an answer on May 28, 2026 at 1:26 pm
    <?php
    $string = "abcdef";
    $chars = str_split($string);
    
    $i = 0;
    while (count($chars) > 1) {
        $i += 3;
        $n = count($chars);
        if ($i >= $n)
            $i %= $n;
    
        unset($chars[$i]);
        $chars = array_values($chars);
    
        echo "DEBUG LOG: n: $n, i: $i; s: " . implode($chars, '') . "\n";
    }
    ?>
    

    Output:

    DEBUG LOG: n: 6, i: 3; s: abcef
    DEBUG LOG: n: 5, i: 1; s: acef
    DEBUG LOG: n: 4, i: 0; s: cef
    DEBUG LOG: n: 3, i: 0; s: ef
    DEBUG LOG: n: 2, i: 1; s: e
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i found many related questions here. I have a simple java program . it
I have tried to use some of the max length functions found here, but
My original question can be found here , for which I've gotten some great
I have built an uploader for my application but struggling on something. Every 3
I know this has been discussed here many times, but none of the answers
originally i was using a .net sdk for facebook found here: http://facebooktoolkit.codeplex.com/ but now,
I've read many articles and several post (including here in stackoverflow) but do not
I'm sure this has been asked here many times but, are there any examples
I have searched, and searched, .. and searched. I have seen many posts here
please I have the same problem as I found here MySQL - Selecting data

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.