Linked Questions
54 questions linked to/from Replace keys in an array based on another lookup/mapping array
2 votes
4 answers
4k views
simple way to change the key value of an array element [duplicate]
Possible Duplicate: In PHP, how do you change the key of an array element? I am reading in a bunch of multi-dimensional arrays, and while digging through them I have noticed that some of the keys ...
4 votes
2 answers
477 views
How to change array key of this array? [duplicate]
Possible Duplicate: In PHP, how do you change the key of an array element? This the array Array ( [0] => Array ( [id] => 1 [due_date] => 2011-09-23 ...
1 vote
3 answers
3k views
How to replace the first value of this array with a new value [duplicate]
I am trying to overwrite [19] in my array, the first value every time. [19] will not always be the same as it populates off an ID that is passed into the array. I want to replace that first index with ...
0 votes
3 answers
360 views
Swap array keys where found in php [duplicate]
I start with a MySQL query (not of my design) that returns results that look like: $row['user_name']; $row['user_property'] $row['user_property_2'] $row['day_1'] $row['day_2'] $row['day_3'] $...
-2 votes
1 answer
836 views
How can i change an index of an array in php [duplicate]
How can i change an index of an array in php? for example $myArray = {"x","y","z","w"}; I want to change the index of myArray [2] to myArray ["two"]
0 votes
2 answers
540 views
Array Map For Keys of An Array PHP [duplicate]
Let's say we have the following dataset: $data = [ 'Newcastle Upon Tyne, Tyne and Wear, England' => 18, 'Gateshead, Tyne and Wear, England' => 17, 'Sunderland, Tyne and Wear, England' =&...
0 votes
1 answer
349 views
How to change Key name from SQL query [duplicate]
I have been looking or a way to change an objects key name with no success as of yet. I need to be able to parse ALL through the keys in the resulting set, check the name of the key, and assign it a ...
1 vote
1 answer
238 views
PHP - How to edit a key of an array? [duplicate]
I have this array that i need to edit the array : Array ( [E:\EasyPHP-cmsServer-14.1VC9\data\cms\sites\user_1\012014.user_1.txt] => TotalVisits 6788 [E:\EasyPHP-cmsServer-14.1VC9\data\...
1 vote
3 answers
72 views
Replace keys of an associative array using another associative array [duplicate]
There is a given array and array to map on. What I try to get is if the keys from given is like the key from map I would like the key from given to become the value from map. Example: the given array ...
0 votes
1 answer
235 views
I have created a form field label dynamically using php/mysql [duplicate]
i want to change the key. this is the output once i submitted the form. Array ( [year] => 1 [event_name] => 2 [Sno] => 6 [First_name] => kodeesswaran [Last_name] =...
-1 votes
2 answers
231 views
Modify array keys of an associative array [duplicate]
I have this array $the_posted = Array ( 0 => Array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, ), 1 => ...
0 votes
2 answers
81 views
how do i replace a character in my array with another character? [duplicate]
i have a array - the output of my array looks like this: Array ( ["US"] => 186 ["DE"] => 44 ["BR"] => 15 ["-"] => 7 ["FR"] => 3 ) and i want to replace the "-" with ...
0 votes
0 answers
33 views
Can a decoded json string element be used as an array key in find/replace using the json data as an array map? [duplicate]
This is not the same question as "Replace keys in an array based on another lookup/mapping array" because the map array does not use numerical keys. I am being given json data from a third ...
637 votes
23 answers
590k views
Insert new item in array on any position in PHP
How can I insert a new item into an array on any position, for example in the middle of array?
79 votes
14 answers
198k views
How to rename sub-array keys in PHP? [duplicate]
When I var_dump on a variable called $tags (a multidimensional array) I get this: Array ( [0] => Array ( [name] => tabbing [url] => tabbing ) [1] => ...