Page 1 of 1

[solved] array-elements in quotes not resolved

Posted: 07 Aug 2023 23:11
by PeterH
Please say multiple "Oh no!" - I did.

So exec the included script, as is, and note the comments.
(Problem only on elements with index = characters)

You remember my un-answered questions about adding associate elements to an indexed array? You and I would not have thought of this answer, so:
in the script uncomment the upper stmt $As[0] = 0; making the array indexed, then exec again. The errors are gone :shock:
(No, I don't think this makes any sense. But is enough for another "Oh no!")

Code: Select all

// Test 0
// $As[0] = 0;

// Test 1
   $As['str'] = 'XYZ';
   $sav = $As['str'];
   Echo "$As['str']";   // >>> not resolved
   $As['str'] .= '789';
   Echo "Sav / New = <crlf>$sav<crlf 2>$As['str']"; // >>> array-name as well as <crlf 2> not resolved

// Test 2
   $As[2] = 'ABC';
   $sav = $As[2];
   Echo "$As[2]";
   $As[2] .= '123';
   Echo "Sav / New = <crlf>$sav<crlf 2>$As[2]"; //
// Test 3
   $sav = $As['str'];
   Echo "$As['str']";   // >>> not resolved
   $As['str'] .= '789';
   Echo "Sav / New = <crlf>$sav<crlf 2>$As['str']"; // >>> array-name as well as <crlf 2> not resolved
edit: typo again

Re: array-elements in quotes not resolved

Posted: 08 Aug 2023 08:00
by admin
Yep, that's a bug. :bug: Fixed in next beta. :tup:

That uncommenting $As[0] = 0; makes it work is just a coincidence.

Re: array-elements in quotes not resolved

Posted: 08 Aug 2023 11:22
by PeterH
A short reply: :tup:

Re: array-elements in quotes not resolved

Posted: 08 Aug 2023 12:46
by PeterH
And now: tested test & prod scripts: :tup: :tup:

Thanks again!