# PHP & XML Help

**URL:** <https://forum.kirupa.com/t/php-xml-help/282663>\
**Category:** programming\
**Created:** [February 24, 2009, 10:12pm UTC](https://forum.kirupa.com/t/php-xml-help/282663 "2009-02-24T22:12:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flash\_Man1](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Flash\_Man1](https://forum.kirupa.com/u/Flash_Man1)\
**Post date:** [February 24, 2009, 10:12pm UTC](https://forum.kirupa.com/t/php-xml-help/282663/1 "2009-02-24T22:12:39Z")

</div>

Hey All,

I have my php code where I run through my xml and display images. But my propblem is that for a file that has three images listed for the item my code displays the following:

```auto
<img src="http://www.something.com/image1.jpg http://www.something.com/image2.jpg"

```

Here is my php code which I am trying to break up the array so it’s array[0] and array[1] etc…

And the XML looks like the following:

```auto

<PROPERTIES>
      <PROPERTY>
            <PHOTOS>
                  <PHOTO>
                        <PHOTOLINK>Image Link 1</PHOTOLINK>
                  </PHOTO>
                  <PHOTO>
                        <PHOTOLINK>Image Link 2</PHOTOLINK>
                  </PHOTO>
                  <PHOTO>
                        <PHOTOLINK>Image Link 3</PHOTOLINK>
                  </PHOTO>
            </PHOTOS>
       </PROPERTY>

```

```php
case $xml_photo_key:
            $propertyDetailsArray[$counter]->PhotoLink .= $data;
            echo $data;
            //$propertyDetailsArray[$counter]->PhotoLink = substr($data,0);
            
            //$p_data = substr($data,0); 
            //$pics = trim($p_data);
            //$images = str_replace(".JPG",".JPG ",$pics);
            
            //print_r (explode(" ",$p_data));

            //echo $images;
            //echo "<br> ***$data*** <br>";
            //echo "".$propertyDetailsArray[$counter]->PhotoLink ."";
            break;

```

Any ideas how to split this up so it works by going $images[0]; and $images[1] etc…  
at the moment it’s showing up like the following

$images[0] displays all three images instead of just one.

Thanks in advance 🙂
