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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:26:13+00:00 2026-05-19T16:26:13+00:00

$original = Array( 0=>03A ,//first 03, substr(04w,0,2)==03 1=>04a ,//first 04 of first 03 2=>05b

  • 0
$original  = Array(
0=>"03A ",//first "03", substr("04w",0,2)=="03"
1=>"04a ",//first "04" of first "03"
2=>"05b ",
3=>"06c ",
4=>"07d ",

6=>"04w ",//second "04" of first "03"
7=>"05x ",
8=>"06y ",
9=>"07z ",

10=>"03B    ",//second "03"
11=>"04l    ",//first "04" of second "03" //substr("04w",0,2)=="03"
12=>"05m    ",
13=>"06n    ",
14=>"07o    ",

15=>"04l    ",//second "04" of second "03" //substr("04l",0,2)=="03"
16=>"05m    ",
17=>"06n    ",
18=>"07o    "
);

echo '<pre>';
print_r($original);
echo '</pre>';

function customize_array($original){
  $customized_array = array();
  foreach($original as $value) {
      if(substr($value,0,2) == "03") {
      // CHANGE 1
      $save = $value;// saved "03" yo put in child too.
      ++$r;//inc parent
      $j = 0; // child 
      $customized_array[$r][$j] =$value; // create parent
      } else {
      if (($j % 4) > 0) $value .= $value;
      // CHANGE 2
      else if ($j && $j % 4 == 0) $value = $save.$value;
      $customized_array[$r][floor($j / 4)] .= $value;
      ++$j;//inc child
      }
  }
  return $customized_array;
}

$display_list = customize_array($original);
echo '<pre>';
print_r($display_list);
echo '</pre>';

OUTPUT:

/*

Array
(
    [1] => Array
        (
            [0] => 03A  04a 05b 05b 06c 06c 07d 07d 
            [1] => 03A  04w 05x 05x 06y 06y 07z 07z 
        )

    [2] => Array
        (
            [0] => 03B  04l 05m 05m 06n 06n 07o 07o 
            [1] => 03B  04l 05m 05m 06n 06n 07o 07o 
        )

)

*/

Everybody here have any idea with the function to get the this result.

/*

   Array
(
    [1] => Array
        (
            [0] => 03A  04a 05b 06c 07d 
            [1] => 03A  04w 05x 06y 07z 
        )

    [2] => Array
        (
            [0] => 03B  04l 05m 06n 07o 
            [1] => 03B  04l 05m 06n     07o 
        )

)


*/
  • 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-19T16:26:14+00:00Added an answer on May 19, 2026 at 4:26 pm

    Two changes:

    foreach($original as $value) {
        if(substr($value,0,2) == "03") {
            // CHANGE 1
            $save = $value;
            ++$r;//inc parent
            $j = 0; // child 
            $move_level[$r][$j] =$value;
        } else {
            if (($j % 4) > 0) $value .= $value;
            // CHANGE 2
            else if ($j && $j % 4 == 0) $value = $save.$value;
            $move_level[$r][floor($j / 4)] .= $value;
            ++$j;//inc child
        }
    }
    

    See it

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

Sidebar

Related Questions

I had a problem that was making the original array to change, the curious
Edit: original title convert numpy array to cvmat was a mistake - OpenCV's less
My original problem was how to map multidimensional int array to string.Following was the
I'm trying to create an unique array regardless of its original order and using
I have one NSMutableArray with 100 objects. This is original array. I have another
I want to get an array composed of the first 4 rows of the
I am having an NSMutableArray as my original array and I want to filter
I need to get an array containing reversed alternate elements of the original array.
I have an associative array called $new_get which comes from the original array of
Here is my snippet. My original array is a[3][][] and the rgb values are

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.