stocker Posted June 27, 2008 Share Posted June 27, 2008 Hello everyone, I have two arrays that I want to join, replacing the values of one with the values of the other. There is a catch though. One array contains 3 arrays, and the other array contains 10 arrays. I have included the arrays below. Here is my goal. Array #1 contains 3 arrays. These 3 arrays have one extra $key=>$value of "BLOGID" that array #2 does not have. I want to either remove the arrays in array #2 that are equal to those in array #1 so that array contains array #1, OR the other option is to add the $key=>$value of "BLOGID" to array #2 and then forgetting array #1 after it's values has been inserted into array $2. I have tried all kinds of things, but nothing works... array_merge, array_unique, etc... it all does not work either because the arrays are not the same length or because php says it cannot convert the strings. So, I am lost and need some help. If any one has some ideas to help out with this, please let me know. Here is array #1 CI_DB_db2u_result Object ( [conn_id] => Resource id #32 [result_id] => Resource id #37 [result_array] => Array ( ) [result_object] => Array ( [0] => stdClass Object ( [bLOGID] => 275 [CATEGORYID] => 129 [PROFILEID] => 80 [CATEGORY] => test 1 ) [1] => stdClass Object ( [bLOGID] => 275 [CATEGORYID] => 145 [PROFILEID] => 80 [CATEGORY] => test 6 ) [2] => stdClass Object ( [bLOGID] => 275 [CATEGORYID] => 146 [PROFILEID] => 80 [CATEGORY] => test 7 ) ) [current_row] => 0 [num_rows] => 1 [row_data] => ) Here is array #2 CI_DB_db2u_result Object ( [conn_id] => Resource id #32 [result_id] => Resource id #40 [result_array] => Array ( ) [result_object] => Array ( [0] => stdClass Object ( [CATEGORYID] => 129 [PROFILEID] => 80 [CATEGORY] => test 1 ) [1] => stdClass Object ( [CATEGORYID] => 149 [PROFILEID] => 80 [CATEGORY] => test 10 ) [2] => stdClass Object ( [CATEGORYID] => 141 [PROFILEID] => 80 [CATEGORY] => test 2 ) [3] => stdClass Object ( [CATEGORYID] => 142 [PROFILEID] => 80 [CATEGORY] => test 3 ) [4] => stdClass Object ( [CATEGORYID] => 143 [PROFILEID] => 80 [CATEGORY] => test 4 ) [5] => stdClass Object ( [CATEGORYID] => 144 [PROFILEID] => 80 [CATEGORY] => test 5 ) [6] => stdClass Object ( [CATEGORYID] => 145 [PROFILEID] => 80 [CATEGORY] => test 6 ) [7] => stdClass Object ( [CATEGORYID] => 146 [PROFILEID] => 80 [CATEGORY] => test 7 ) [8] => stdClass Object ( [CATEGORYID] => 147 [PROFILEID] => 80 [CATEGORY] => test 8 ) [9] => stdClass Object ( [CATEGORYID] => 148 [PROFILEID] => 80 [CATEGORY] => test 9 ) ) [current_row] => 0 [num_rows] => 1 [row_data] => ) Link to comment https://forums.phpfreaks.com/topic/112248-multi-dimensional-array-question/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.