0

I'm having troubles getting one variable from an array.

If I echo the array it looks like this:

echo print_r($order_total_modules);

And it prints out this:

    order_total Object ( 
         [modules] => Array ( 
                [0] => ot_quantity_discount.php 
                [1] => ot_shipping.php 
                [2] => ot_subtotal.php 
                [3] => ot_tax.php 
                [4] => ot_total.php 
     ) )

I would like to print out only this part: [1] => ot_shipping.php

How can I achieve this?

1 Answer 1

1

$order_total_modules is an object, object access notation is ->, then you have module which is an array and normal array notation is with []:

$order_total_modules->modules[1]; //returns ot_shipping.php
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I'm fairly new to PHP and I don't use it much and that really helped me.

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.