-1

I have the following code and the output will be in array. How can I find arrays that match between $pesara and $ahli. the condition between it is CURRENT_ID_NO is equal to ic_no

$sql = "SELECT CURRENT_ID_NO, NAME, MOBILE_NO FROM pesara";
    $dbCommand = Yii::app()->db->createCommand($sql);
    $pesara = $dbCommand->queryAll();

$sql2 = "SELECT name, ic_no, ic_type, tel_no, pesara, created_dt, created_by, updated_dt, updated_by FROM ost_ahli";
    $dbCommand2 = Yii::app()->db->createCommand($sql2);
    $ahli = $dbCommand2->queryAll();

$result = array_intersect($pesara->CURRENT_ID_NO, $ahli->ic_no);
    print_r($result);

Sorry for my bad English but I hope someone can help me on this.

Nurul
  • 29
  • 1
  • 4

1 Answers1

0

You can use array_uintersect() for custom comparison

and also have sample code for that here

Paritosh Mahale
  • 1,238
  • 2
  • 14
  • 42