0

I'm to return data from a provider and the array supplied looks like this :

Array
(
    [result] => Array
        (
            [0] => Array
                (
                    [problem_id.u_root_cause] => 
                    [number] => INC0000001
                    [short_description] => Unable to print
                    [u_alert_check] => 
                    [u_business_service] => Array
                        (
                            [display_value] => Printer
                            [link] => https://redacted/37bc8af837c3820ca7e3b15ec3990e1c
                        )

                    [assignment_group] => Array
                        (
                            [display_value] => Printer Support
                            [link] => https://redacted/b699595c37dac200a7e3b15ec3990eb1
                        )

                    [u_service_impact_duration] => 57 Minutes
                    [u_summary_notes] => Changed USB cable 
                    [u_environment] => Production (PD)
                    [problem_id] => 
                    [priority] => 3 - P3
                    [u_business_services_impacted] => 
                )

Now, I'm able to return most of the data like this,

foreach($data['result'] as $line){
   echo $line['number'];
   echo '<br>';
   echo $line['short_description'];
}

The above returns the number and short_description from the array.

The trouble I have is how do I return u_business_service in the same line?

  • Does this answer your question? [How to get directory size in PHP](https://stackoverflow.com/questions/478121/how-to-get-directory-size-in-php) – francisco neto Sep 19 '20 at 12:46

1 Answers1

0

For acessing the multidimensional array you may use:

echo $line['u_business_service']['display_value'];
echo $line['u_business_service']['link'];
francisco neto
  • 797
  • 1
  • 5
  • 13