3,316 questions
4 votes
4 answers
106 views
Map unknown associative array element
How can I map an unknown value alongside other known values in bash using an associative array, so that: #!/bin/bash array=("foo" "foo" "bar" "something else" &...
-1 votes
2 answers
215 views
How to deserialize ${aa[@]@K} into referenced associative array with no eval effect?
How can I reference an associative array and reassign its content from serialized string? (The eval requirement is now spelled out explicitly in the title, but this is natural when it comes to ...
1 vote
1 answer
82 views
Displaying individual rows with same key as part of larger associative array using PHP and HTML
I am trying to display data from multiple MySQL tables in individual text fields in an HTML form using PHP. Here are three sample tables from a database, followed by code that I am using to select ...
3 votes
2 answers
199 views
What kind of implementation can I use for a static associative array on a vintage system with very limited resources?
I'm working on a project written in C that's going to be deployed on vintage systems with very limited resources. The target system has at minimum a 16 MHz Motorola 68030 processor with a 256 byte L1 ...
-4 votes
1 answer
138 views
Building nested array with foreach [closed]
I am trying to build an associative multidimensional array like this: array( [0] => Array( Parent => Mr Smith, Children => array( Firstmane => Bob, ...
0 votes
2 answers
79 views
Global associative array (hash) in the older bash-4
The following script works as expected for me on FreeBSD using bash-5: function a { declare -gA Seen if [[ -v Seen[$1] ]] then echo "Saw $1 already" return ...
1 vote
3 answers
117 views
Dlang associative array of an array of strings keyed by a string has unexpected behavior
The output from the following code does not behave how I think it should. It appears that making changes to the string array returned by testAA.require() does not reflect in the associative array. I ...
1 vote
4 answers
113 views
Use flat array's values to generate an associative array whose keys and values are given a static prefix
Is there a shorthand for the following code: $result = array_combine( array_map(fn($elem) => "key_$elem", $array), array_map(fn($elem) => "value_$elem", $array) ); ...