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 following
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:";
> > echo "first = $first";// prints: first = plementa
"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 = "E
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 cod
"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 = "E
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
c
6 matches
Mail list logo