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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:50:51+00:00 2026-06-16T05:50:51+00:00

I have a source array $A = array( 0=> array( ‘title’=>’HTML5+CSS3’, ‘teacher’=>’jonh’, ‘id_post’=>1,/* link

  • 0

I have a source array

$A = array(
    0=> array(
        'title'=>'HTML5+CSS3',
        'teacher'=>'jonh',
        'id_post'=>1,/* link to  $post_formation */
        'formation'=>1,
        'date'=>'12/12/2112'
    )
);

and the an other array:

$post_formation = array(
            0=>array(1,2,3),
            1=>array(3,4,5)
        )

Look in $A to manipulate a new restult (in this case id_post=1 1=>array(3,4,5) so will contain more 3 elements )

$result = array(
    /* from $A */
    0=> array(
        'title'=>'HTML5+CSS3',
        'teacher'=>'jonh',
        'id_post'=>1,

        'formation'=>1,
        'date'=>'12/12/2112'
    ),

    /* Append here  more 03 elements `3,4,5` */
    1=> array(
        'title'=>'(A)HTML5+CSS3',
        'teacher'=>'jonh',
        'id_post'=>1,

        'formation'=>3,
        'date'=>'--/--/---'
    ),
    2=> array(
        'title'=>'(A)HTML5+CSS3',
        'teacher'=>'jonh',
        'id_post'=>1,

        'formation'=>4,
       'date'=>'--/--/----'
    ),
    3=> array(
        'title'=>'(A)HTML5+CSS3',
        'teacher'=>'jonh',
        'id_post'=>1,

        'formation'=>5,
        'date'=>'--/--/----'
    )
);

Anyone could tell me how todo this?

  • 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-16T05:50:52+00:00Added an answer on June 16, 2026 at 5:50 am

    Though a little weird……

    $A=array(array("title"=>"HTML5+CSS3","teacher"=>"john","id_post"=>1,"formation"=>1,"date"=>"12/12/2012"));
    $post_information=array(0=>array(1,2,3),1=>array(3,4,5));
    print_r($A);
    if(isset($post_information[$A[0]["id_post"]]))
    {
        foreach($post_information[$A[0]["id_post"]] as $idx)
        {
            $cache=$A[0];
            $cache["title"]="(A)".$cache["title"];
            $cache["formation"]=$idx;
            $cache["date"]="--/--/----";
            $A[]=$cache;
        }
    }
    print_r($A);
    

    Result:

    The first print_r:

    Array
    (
        [0] => Array
            (
                [title] => HTML+CSS3
                [teacher] => john
                [id_post] => 1
                [formation] => 1
                [date] => 12/12/2012
            )
    
    )
    

    The second print_r:

    Array
    (
        [0] => Array
            (
                [title] => HTML+CSS3
                [teacher] => john
                [id_post] => 1
                [formation] => 1
                [date] => 12/12/2012
            )
    
        [1] => Array
            (
                [title] => (A)HTML+CSS3
                [teacher] => john
                [id_post] => 1
                [formation] => 3
                [date] => --/--/----
            )
    
        [2] => Array
            (
                [title] => (A)HTML+CSS3
                [teacher] => john
                [id_post] => 1
                [formation] => 4
                [date] => --/--/----
            )
    
        [3] => Array
            (
                [title] => (A)HTML+CSS3
                [teacher] => john
                [id_post] => 1
                [formation] => 5
                [date] => --/--/----
            )
    
    )
    

    You can of course wrap the logic in a function instead of plainly modify the source $A.

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

Sidebar

Related Questions

I have a tableview and an array source. When I init array in viewDidLoad
I have an array of strings of the form: @source = ( something,something2,third ,something,something3
I have a multidimensional array of arrays (source below), where my keys and values
I have a byte array of size 4 byte[] source = new byte[4]; Now
I have this source data [gallery] Title [galleryitem]http://www.google.com/image.jpg[/galleryitem] [galleryitem]http://www.google.com/image.jpg[/galleryitem] [galleryitem]http://www.google.com/image.jpg[/galleryitem] [galleryitem]http://www.google.com/image.jpg[/galleryitem] [galleryitem]http://www.google.com/image.jpg[/galleryitem] [galleryitem]http://www.google.com/image.jpg[/galleryitem] [/gallery]
This is the source $pData array I have: Array ( [code] => 105132 [globalImages]
I have source array, and I want to generate new array from the source
I have a subclassed nstableview whose data source array may increase, by calling reloadData:
I have a function named resize, which takes a source array, and resizes to
I have source XMLfiles that come in with multiple root elements and there is

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.