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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:34:47+00:00 2026-05-31T21:34:47+00:00

what i want to do is that i am creating php array dynamic .i

  • 0

what i want to do is that i am creating php array dynamic .i dont know about the elements in the array. lets say i have array like this

$mix_array =array('1','3','6','1','5','3','6','5','1','7','3','9');

i want slicing of this array.i want to create arrays from the above array but of common elements like

$array_1 = ('1','1','1');
$array_2 = ('3','3','3');
$array_3 = ('6','6');
$array_4 = ('5','5');
$array_5 = ('9');
$array_6 = ('7');

that is first find common elements in original array and make other array from that

  • 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-31T21:34:48+00:00Added an answer on May 31, 2026 at 9:34 pm

    There are several ways to do it, here is an example (by the way, quite inefficient, but enough if it is a short work):

    <?php
    $mix_array = array('1','3','6','1','5','3','6','5','1','7','3','9');
    $sliced_array = array();
    
    foreach($mix_array as $k => $v) {
        if( count($sliced_array[$v]) > 0 ) {
            array_push($sliced_array[$v], $v);
        } else {
            $sliced_array[$v] = array($v);
        }
    }
    ?>
    

    You should take a look at http://es.php.net/manual/en/ref.array.php

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

Sidebar

Related Questions

I have a php file that is creating a array of everything in my
Is there a way of creating an age select list like this: <?php $Array
I have such view that handles user registration. After creating new user i want
I have a problem making a select tag in php code dynamic. I'm creating
I'm creating the array dynamically using this tool. http://174.121.67.116/~achadire/aware5/product_options.php?cid=6 The array output looks like
I know that more-dynamic-than-Java languages, like Python and Ruby, often allow you to place
I have a table that's generated by a normal PHP loop. What I want
We're using Doctrine, a PHP ORM. I am creating a query like this: $q
I am creating an URL like this: www.mysite.com/xyz.php/0:100003044058740-1:100000657838131-2:100001676304188-3:1075440919-4:100002474721536-5:100003033556875-6:1257699872-7:1257699872-8:100000501703505-9:100000297352382 from this function in my .php
I am creating a model for users and I want that property joined was

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.