0

i have an output in a object

it looks like below,

stdClass Object
    (
        [0] => stdClass Object
            (
                [id] => 14
                [tcaseid] => 11
                [step] => a
                [teststep] => a
                [expected_data] => a
                [actual_result] => a
                [pass_fail] => 1
                [notes] => a
            )

        [1] => stdClass Object
            (
                [id] => 15
                [tcaseid] => 11
                [step] => b
                [teststep] => b
                [expected_data] => b
                [actual_result] => b
                [pass_fail] => 1
                [notes] => b
            )

        [2] => stdClass Object
            (
                [id] => 16
                [tcaseid] => 11
                [step] => d
                [teststep] => d
                [expected_data] => d
                [actual_result] => d
                [pass_fail] => 1
                [notes] => d
            )

        [3] => stdClass Object
            (
                [id] => 17
                [tcaseid] => 11
                [step] => e
                [teststep] => e
                [expected_data] => e
                [actual_result] => e
                [pass_fail] => 1
                [notes] => e
            )

        [id] => 11
        [project_id] => 1
        [title] => title
        [description] => desc
        [module_id] => 1
        [usecaseid] => 1
        [tcaseid] => 5
    )

my question is how to get this value ( [id] => 11 )

i have tried

* $data->id

* $data['id'];

any help?

Deenadhayalan Manoharan
  • 5,436
  • 14
  • 30
  • 50
sivanthi
  • 11
  • 1
  • 6

1 Answers1

1

You can try

$data[4]['id']; 

Link For Ref: http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/