i have a array like

    array(2) {
      [0]=>
      array(18) {
        [0]=>
        array(8) {
          ["attandance_id"]=>
          string(3) "162"
          ["entry_date_time"]=>
          string(19) "0000-00-00 00:00:00"
          ["attandance_date"]=>
          string(10) "2016-04-06"
          ["class_id"]=>
          string(5) "11232"
          ["user_id"]=>
          string(5) "53697"
          ["status"]=>
          string(1) "3"
          ["timestamp_key"]=>
          string(27) "99b2f75ac6de8a52_1460025757"
          ["create_by"]=>
          string(1) "0"
        }
        [1]=>
        array(8) {
          ["attandance_id"]=>
          string(3) "163"
          ["entry_date_time"]=>
          string(19) "0000-00-00 00:00:00"
          ["attandance_date"]=>
          string(10) "2016-04-06"
          ["class_id"]=>
          string(5) "11232"
          ["user_id"]=>
          string(5) "95079"
          ["status"]=>
          string(1) "3"
          ["timestamp_key"]=>
          string(27) "99b2f75ac6de8a52_1460025757"
          ["create_by"]=>
          string(1) "0"
        }

and now i have another array like this

    array(44) {
      [0]=>
      array(1) {
        [0]=>
        array(1) {
          ["user_nicename"]=>
          string(5) "Ashish"
        }
      }
      [1]=>
      array(1) {
        [0]=>
        array(1) {
          ["user_nicename"]=>
          string(12) "Sapla"
        }
      }

now i want to user_nicename key to be in first array posted above as shown

["attandance_id"]=>
          string(3) "163"
          ["entry_date_time"]=>
          string(19) "0000-00-00 00:00:00"
          ["attandance_date"]=>
          string(10) "2016-04-06"
          ["class_id"]=>
          string(5) "11232"
          ["user_id"]=>
          string(5) "95079"
          ["status"]=>
          string(1) "3"
          ["timestamp_key"]=>
          string(27) "99b2f75ac6de8a52_1460025757"
          ["create_by"]=>
          string(1) "0"
          ["user_nicename"]=>
          string() "Ashish"

how can i achieve this?

Well... the most straight forward way is

let first arr = $aArr;
let second arr = $aArr2;

$aArr[0][1]['user_nicename'] = $aArr2[0][0]['user_nicename'];

However, this is assuming the same data every time... what I can't devise is what your data structure looks like, or how they relate - and if they are all part of the same database, why not just get it from the SQL instead of merging after the fact?

The only way you can really do this is by iterating over everything, finding specific keys (which I don't understand at all how these two arrays match up), and then merging them as the above example shows when finding a matching pair.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.