Is it possible to rename an array within a script?

Sorry about starting so many threads*, but honest, I have been searching on this idea for several hours. Here, php.net, phpfreaks, etc and have come up with bupkis...

  • (In my own defense, I do try to make my thread names real succinct and conceptually clear to facilitate future searches by others. This overrides my initial impulse, which would name every new thread "Help me! Puleeeeeeze! I'm desperate! ).🙂
    $array = array(1,2,3);
    $renamed_array = $array;
    

      Use a reference.

      $newname = &$oldname;

      This will allow changes made to $newname to impact $oldname.

        ..... I am sooooooo embarassed.

        :o

        Thanks

        (and the bit about the "&" reference would have never occurred to me.)

          Write a Reply...