Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Extracting data from specific subarray

I have the following array and I am trying to get data out of ‘[0]’.

Array (
  [ID] => 103088
  [key] => field_65002d05c4f14
  ... more elements
  [value] => Array (
    [0] => Array (
      [file_title] => Spec Sheet - with contents
      [file] => URL
    )
  )
  ... more elements
)

I have gone through to complete my foreach loop however I am getting no output – WordPress functions.php

foreach($arrayOBJ as $value => $file){
    //echo '<li><a href="'.$file['file'].'"></a>Some Text</li>';
}

I am expecting to be able to generate lines with "file" as the href and some text as the text.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use:

foreach($arrayOBJ['value'] as $file){
  //echo '<li><a href="'.$file['file'].'"></a>Some Text</li>';
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading