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
confused about the result.

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";
$second = "Middle";

echo "before assignment:<BR>";
echo "first = $first<BR>";    // prints: first = Elementary
echo "second = $second<P>";   // prints: second = Middle   --- looks as
expected here


$first[$second] = "pass";


echo "After Assignment:<BR>";
echo "first = $first<BR>";    // prints: first = plementary   ---  what is
this ????!!
echo "second = $second<BR>";  // prints: second = Middle
echo "$first[$second]";    // prints: P

Thanks




-- 
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