2 multidimensional array questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tarscher@gmail.com

    2 multidimensional array questions

    Hi all,

    2 array questions;
    I have a multidimensiona l matrix.
    C1 C2 C3 C4
    R1[] [] [] []
    R2[] [] [] []
    R3[] [] [] []
    R4[] [] [] []
    R5[] [] [] []
    R6[] [] [] []
    R7[] [] [] []
    R8[] [] [] []

    1. Is it possible to search in a specific column?
    eg: only search for a value in in C2 and get the rownumber as result?

    2. Copy one or more rows and put them in between other rows?
    eg: move row 5 and 6 between row 1 and row 2.
    C1 C2 C3 C4
    R1[] [] [] []
    R5[] [] [] []
    R6[] [] [] []
    R2[] [] [] []
    R3[] [] [] []
    R4[] [] [] []
    R7[] [] [] []
    R8[] [] [] []

    Thanks in advance
    Stijn

  • blackghost

    #2
    Re: 2 multidimensiona l array questions

    1. Is it possible to search in a specific column?

    try :

    $fixed_col = 5;

    for ($i=1;$i<=row_n umbers;$i++) {
    if ( $table[$fixed_col][$i] == $search_value ) {
    echo "found !";
    exit;
    }
    }

    Comment

    Working...