lundi 27 juin 2016

Is there a way to check if value in object is set without using foreach?

I have the following JSON object:

{
  "screen": 1,
  "parameters": {
    "title": "Fill in the form:",
    "values": [
      {
        "id": 13,
        "type": 2,
        "name": "A",
        "label": "Lorem ipsum",
        "value": 10
      },
      {
        "id": 14,
        "type": 2,
        "name": "B",
        "label": "Lorem ipsum",
        "value": 20
      }
    ]
  }
}

In the code I can access the values using $screen->values.

Is there a fast way to check if the values of answer A and B are filled in? I tought something like this:

if(isset(A) && isset(B)) { ... }

For those who are interested, I use laravel 5, maybe there is a method for it?

It looks like I need an array, but I rather avoid those in this case...



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28XDsx5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire