0

When i call API i found this array object "online_bill_list" object is unknown to me. Please see details.

stdClass Object
(
[online_bill_list] => stdClass Object
    (
        [tbl_bill] => stdClass Object
            (
                [id] => 2081804
                [ClientID] => 01-001-0287-00
                [holdingNo] => 01-001-0287-00
                [billno] => 01-001-0287-0032017
                [date_month] => 2017-03-01T00:00:00
                [unit] => 0.0000
                [others] => 0.0000
                [fine] => 
                [due] => 
                [bill] => 250.0000
                [netbill] => 255.0000
                [payment_date] => 2017-04-30T00:00:00
                [inserted_date] => 2017-04-18T00:00:00
        )
    )
)

I want to convert this array in a single array object.

[tbl_bill] => stdClass Object
(
    [id] => 2081804
    [ClientID] => 01-001-0287-00
    [holdingNo] => 01-001-0287-00
    [billno] => 01-001-0287-0032017
    [date_month] => 2017-03-01T00:00:00
    [unit] => 0.0000
    [others] => 0.0000
    [fine] => 
    [due] => 
    [bill] => 250.0000
    [netbill] => 255.0000
    [payment_date] => 2017-04-30T00:00:00
    [inserted_date] => 2017-04-18T00:00:00

)
2
  • 1
    $single = $initial->online_bill_list->tbl_bill Commented May 15, 2017 at 8:37
  • online_bill_list and tbl_bill is dynamic value is there anyway in PHP to convert multiple object array to single array object. Commented May 15, 2017 at 8:41

2 Answers 2

1

Then all you have to do is pick the object you want out of the larger object

$tbl_bill = $BigObject->online_bill_list->tbl_bill;
Sign up to request clarification or add additional context in comments.

1 Comment

Well with this the new variable $tbl_bill will be just the tbl_bill object. Thats what you wanted right?
0

You just need to pick the object you want. Please try the following examples.

Print the object

print_r($object->online_bill_list->tbl_bill);

Storing and printing the object.

$array = $object->online_bill_list->tbl_bill;
print_r($array);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.