[PHP] Array assignment references: strange behavior

2005-06-30 Thread Nenad Jovanovic
Hi! Under PHP 4.3.10, the following simple code behaves as expected: $b[1] and $c are not modified by the final assignment to $a[1]: Code 1: $a[1] = 1; $b[1] = 2; $c = 3; $a = $b; $a[1] = 7; // resulting mappings: // $a[1] ... 7 // $b[2] ... 2 // $c .. 3 However, the

Re: [PHP] Array Assignment

2001-05-05 Thread Gyozo Papp
Mark Cain [EMAIL PROTECTED] wrote in message 9cufuv$s20$[EMAIL PROTECTED]">news:9cufuv$s20$[EMAIL PROTECTED]... Two things: 1) Why does the code below produce this result? 2) How do I assign to an multidimensional array with dynamic keys? Here is the test code: $first = Elementary;

Re: [PHP] Array Assignment

2001-05-05 Thread Alexander Skwar
So sprach Christian Reiniger am Fri, May 04, 2001 at 08:24:21PM +0200: On Saturday 05 May 2001 16:55, Mark Cain wrote: $first = Elementary; $second = Middle; $first[$second] = pass; echo After Assignment:BR; echo first = $firstBR;// prints: first = plementary --- what is

[PHP] Array Assignment

2001-05-04 Thread Mark Cain
I'm new to PHP (which will be obvious in just a minute). In Perl I can assign dynamic keys ad infinitum to an array such as: $sku{$id}{$line}{$price} = 99; But the syntax is escaping me for the same function in PHP. As I was trying to debug my thinking, I ran the following little test and am

RE: [PHP] Array Assignment

2001-05-04 Thread Gyozo Papp
Mark Cain [EMAIL PROTECTED] wrote in message 9cufuv$s20$[EMAIL PROTECTED]">news:9cufuv$s20$[EMAIL PROTECTED]... Two things: 1) Why does the code below produce this result? 2) How do I assign to an multidimensional array with dynamic keys? Here is the test code: $first = Elementary;

Re: [PHP] Array Assignment

2001-05-04 Thread Christian Reiniger
On Saturday 05 May 2001 16:55, Mark Cain wrote: In Perl I can assign dynamic keys ad infinitum to an array such as: $sku{$id}{$line}{$price} = 99; Same in PHP: $sku [$id] [$line] [$price] = 99; if $sku is an array. If unsure, initialize it as one: $sku = array (); Here is the test code: