-3

This is my array:

  array(3) {
      ["formData"]=>
      array(25) {
        ["Contact.Name.First"]=>
        object(stdClass)#17 (2) {
          ["value"]=>
          string(31) "POLIANA KRUSCHER PISCOLLE"
          ["required"]=>
          bool(true)
        }
        ["Contact.CustomFields.c.new_cpf"]=>
        object(stdClass)#21 (2) {
          ["value"]=>
          string(14) "038.889.971-99"
          ["required"]=>
          bool(true)
        }
    }

How can I retrieve value in Contact.CustomFields.c.new_cpf?

I tried $incident_data['Contact.CustomFields.c.new_cpf']['value'], but it returns null.

k0pernikus
  • 60,309
  • 67
  • 216
  • 347
Douglas
  • 3
  • 2

2 Answers2

0

Try this way:

$incident_data['formData']['Contact.CustomFields.c.new_cpf']->value;
RomanPerekhrest
  • 88,541
  • 4
  • 65
  • 105
0

Your $incident_data['formData']['Contact.CustomFields.c.new_cpf'] does not contain an array yet you try to access it as such.

Since there is no such key php defaults to null. (Yet there also should be an undefined index notice thrown around. You may want to enhance your error logging / strictness level).

As by your dump you have an of the \stdClass class, you have to treat them as such:

$object->value
k0pernikus
  • 60,309
  • 67
  • 216
  • 347