user3718908x100
user3718908x100

Reputation: 8509

Array To String Conversion Error When Using array_diff

Hello i am trying to return the differences between two arrays but i am gettig this error that i do not understand, this is my code:

$unMatched = array_diff($matchedTickets, $cart['tickets']);

These are the two arrays:

$cartTickets:

array (size=1)
  0 => 
    array (size=5)
      'id' => int 13
      'class' => string 'Regular' (length=7)
      'description' => string 'Lorem ipsum dolor' (length=17)
      'fee' => int 100
      'quantity' => int 1

$matchedTickets:

array (size=1)
  0 => 
    array (size=3)
      'id' => int 13
      'class' => string 'Regular' (length=7)
      'fee' => float 100

Can somebody please tell me what i am doing wrong here?

Upvotes: 1

Views: 1440

Answers (1)

user3718908x100
user3718908x100

Reputation: 8509

I had to add the index 0 to each of them to get it to work. I dont know why they're like that, but it works now.

Upvotes: 1

Related Questions