Array Element in String

Good morning!

I am trying to call an element of a variable array in a string.

[pre]“This is a test string $test”[/pre] produces the desired results, but [pre]“This is a test string $test[0]”[/pre] returns [pre]This is a test string [0][/pre]

Any advice would be very much appreciated. Thank you!

"This is a test string $($test[0])"

Thanks for the response! That’s closer, but not giving me what I need.

So if $test[0] = horse

[pre] “this is a test $($test[0])”[/pre] it outputs [pre]this is a test @{test=horse}"[/pre]

 

Is there a way I can pull just the array string without the braces and the variable name?

seems like its an object with property test

"this is a test $($test[0].test)"

[quote quote=168544]seems like its an object with property test

<textarea class="ace_text-input" style="opacity: 0; height: 18px; width: 7px; left: 44px; top: 0px;" spellcheck="false" wrap="off"></textarea>
1
2
"this is a test $($test[0].test)"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[/quote]

Your suggestion worked, kvprasoon. Thank you so much!