At least not the way I expected it to. Apparently I am doing something
wrong, but I can't find anything specific that explains it. This is in
PHP 5.2.6.

Here is the sequence I am trying to implement without the database
portion. (This is typed in since the VNC I am using doesn't support
pasting from a Linux client to a MS-Windows server.)

-------------------------------------
$buff = "key1|value1~key2|value2";

$lines = explode ("~", $buff);

foreach ($lines as $kvpair) {
   $line = explode ("|", $kvpair);
   if ($line[0] == "key1") {
      $line[1] = "value3";
      $kvpair = implode ("|", $line);
      break;
   }
}
$newbuff = implode ("~", $lines);
-------------------------------------

$kvpair is modified, but that change is ignored by implode() with
$newbuff still containing "key1|value1".

So why doesn't the change to $kvpair get brought in by implode? What
should I do to update that value?

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to