I have an array, $field, like following:

Array ( [0] =>
             Array ( [0] => Array (  [disp] => computer
                                                 [index] => computer )
                         [1] => Array (  [disp] => or
                                                 [index] => @or )
                         [2] => Array (  [disp] => title
                                                 [index] => @at 1=4 term
                                                 [name] => ti )
                          )
            [1] =>
             Array ( [0] => Array (  [disp] => human
                                                 [index] => human)
                         [1] => Array (  [disp] => or
                                                 [index] => @or )
                         [2] =>Array (   [disp] => subject
                                                 [index] => @at 1=5 term
                                                 [name] => s )
                           )
             [2] =>
             Array ( [0] => Array (  [disp] =>
                                                 [index] => John)
                         [1] => Array (  [disp] => or
                                                 [index] => @or )
                         [2] => Array (  [disp] => tsd
                                                 [index] => @at 1=5 term @at
7=44 term
                                                 [name] =>  tsd)
                       )
            [3] =>
              Array ( [0] => Array (  [disp] =>
                                                  [index] => Eric)
                          [1] => and
                          [2] => Array (  [disp] => subject
                                                  [index] => @at 9=5 term
                                                  [name] => s )
                           )
            [4] =>
               Array ( [0] => Array (  [disp] =>
                                                   [index] => Main)
                           [1] => and
                           [2] => Array (  [disp] => subject
                                                   [index] => @at 9=5 term
                                                   [name] => s )
                            )
             [5] =>
               Array ( [0] => Array (  [disp] =>
                                                   [index] => Dog)
                           [1] => and
                           [2] => Array (  [disp] =>
                                                   [index] =>
                                                   [name] =>  )
                           )
)

In each string, $field[$j][2]["index"] in the array, will I replace 'term'
with  the
word in "{$field[$j][0]["index"]}".
Why doesn't it work like this?:
---------------------------
1.    for($j=0; $j<6; $j++){
2.            $temp
=str_replace("term","{$field[$j][0]["index"]}","{$field[$j][2]["index"]}");
3.            echo "<br>temp: $temp";
4.            $field[$j][2]["index"]=$temp;
5.            echo "<br>utskrift:  ${$field[$j][2][index]}";
6.    }
7.    echo "<br>field: <br>";
8.    print_r($field);
-------------------------
Line 3 and 6 gives the same, and correct outprint, but in line 8 nothing is
changes from how it looked before the loop. "term" is still term and not
replaced.
What am I doing wrong!?

Thanks!

anette




------------------------------------------------------------
Bra att veta:
Hardware is the part of a computer that can be kicked,
if all you can do is swear at it, then it must be software.
------------------------------------------------------------
Anette Löfquist      e99al
icq#: 69648675













-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to