Check if an array value is true [duplicate]

I have an array of an user that is of Boolean type. I am trying to set a condition to say that if the value of this array is false, to display a message. This is my array


the $user is an object that returns the user data. For confirmed, it returns either True or False.

I am doing something like this.

if ($user[0]['Confirmed'] === true)
   //Do something. 

when I do that, I get an error

Warning: Illegal string offset 'confirmed'

How can i arrange this better so that it can get passed my condition?

user object is like this:

   username: "abc,
   firstName: "abc2",
   lastName: "abc,
   confirmed: true,


Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *