petritr
11 months ago
125
8
Laravel

Get difference from object and array

Posted 11 months ago by petritr

Witch is the best way to get the difference from object and array(i need to find witch ring_id is not in both object and array)

my object:

Collection {#779
  #items: array:2 [
    0 => {#776
      +"id": 270
      +"ring_id": 25
    }
    1 => {#777
      +"id": 271
      +"ring_id": 2
    }
  ]
}

Array:

array:1 [
  0 => array:11 [
    "id" => 10
    "ring_id" => 2
    "ring_name" => "Ring Name"
    "comment" => null
    "created_at" => "2018-12-10 09:17:22"
    "updated_at" => "2018-12-10 09:18:24"
  ]
]

How can i get the different ring_id that don't exist in the array ?

Please sign in or create an account to participate in this conversation.