Array Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Damodhar

    Array Help

    HI any one help me to solve the solution



    one array having the values like

    $array1 = array(1,2,3,4);

    $array2 = array(A,B,C,D);


    i want to create the new array array using the array1 and array2

    like :
    $ans = array(1,A,2,B,3 ,C,4,D)


    how can i create the new array is there any predefined functions or
    any ???
  • Alred Wallace

    #2
    Re: Array Help


    "Damodhar" <damu.be@gmail. coma écrit dans le message de news:
    5860b5e3-c196-424b-8f58-72fea657dd1f...l egroups.com...
    HI any one help me to solve the solution
    >
    >
    >
    one array having the values like
    >
    $array1 = array(1,2,3,4);
    >
    $array2 = array(A,B,C,D);
    >
    >
    i want to create the new array array using the array1 and array2
    >
    like :
    $ans = array(1,A,2,B,3 ,C,4,D)
    >
    >
    how can i create the new array is there any predefined functions or
    any ???

    $newArray = array();
    for( $i=0;$i<count( $array1 ); $i++ ){
    $newArray[] = array1[$i];
    $newArray[] = array2[$i];
    }


    Comment

    • Guillaume

      #3
      Re: Array Help

      Damodhar a écrit :
      one array having the values like
      >
      $array1 = array(1,2,3,4);
      >
      $array2 = array(A,B,C,D);
      >
      >
      i want to create the new array array using the array1 and array2
      >
      like :
      $ans = array(1,A,2,B,3 ,C,4,D)


      Regards,
      --
      Guillaume

      Comment

      • Damodhar

        #4
        Re: Array Help

        hi Alred Wallace,

        thanks for your code wonderful,

        Comment

        Working...