Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8197515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:45:28+00:00 2026-06-07T05:45:28+00:00

Here is my address.xml <?xml version=1.0 ?> <!–Sample XML document –> <AddressBook> <Addressentry> <firstName>jack</firstName>

  • 0

Here is my address.xml

<?xml version="1.0" ?>
<!--Sample XML document -->
<AddressBook>
    <Addressentry>
        <firstName>jack</firstName>
        <lastName>S</lastName>
        <Address>2899,Ray Road</Address>
        <Email>jkjsvsdka@ghu.edu</Email>
    </Addressentry>
    <Addressentry>
        <firstName>Sid</firstName>
        <lastName>K</lastName>
        <Address>238,Baseline Road,TX</Address>
        <Email>sk@ghu.edu</Email>
        <Email>sk@gmail.com</Email>
    </Addressentry>
    <Addressentry>
        <firstName>Satya</firstName>
        <lastName>Yar</lastName>
        <Address>6,Rural Road,Tempe,AZ</Address>
        <Email>syarlag@ghu.edu</Email>
       <Email>ssya@gmail.com</Email>
        <Email>satag@yahoo.com</Email>
    </Addressentry>

</AddressBook>

I am trying to load all the entries using PHP code as below. Each addressentry can have one or more tags. Right now from the code below I am able to extract only one tag. My question is how do I extract all tags associated with particular Addressentry. that is I want to print all emails on the same line.

<?php
$theData = simplexml_load_File("address.xml");

foreach($theData->Addressentry as $theAddress) {
    $theFirstName = $theAddress->firstName;
    $theLastName = $theAddress->lastName;
    $theAdd = $theAddress->Address;


    echo "<p>".$theFirstName."
    ".$theLastName."<br/>
    ".$theAdd."<br/>
    ".$theAddress->Email."<br/>
    </p>";


    unset($theFirstName);
    unset($theLastName);
    unset($theAdd);
    unset($theEmail);
}
?>

Any help would be appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:45:29+00:00Added an answer on June 7, 2026 at 5:45 am
    $emails = array();
    foreach ($theAddress->Email as $email) {
        $emails[] = $email;
    }
    echo "<p>".$theFirstName."
        ".$theLastName."<br/>
        ".$theAdd."<br/>
        ".implode(', ', $emails)."<br/>
        </p>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my XML: <?xml version=1.0 ?> <AddressValidateResponse> <Address ID=0> <FirmName>FIRM NAME, INC</FirmName> <Address2>123
I have the following XML: <?xml version=1.0 encoding=UTF-8?> <details> ... <address1>Test&amp;Address</address1> ... </details> When
here's my task. I've parsed an xml document and stored all of its data
I have these XML on a URL <?xml version=1.0 encoding=ISO-8859-1 ?> <Phonebook> <PhonebookEntry> <firstname>John</firstname>
Here is a simplified version of the XML returned. <?xml version=1.0 encoding=UTF-8 ?> <kml
Following is sample XML File - <?xml version=1.0 encoding=UTF-8?> <Catalog> <Book> <AName>Steven Holzner</AName> <BName>Using
I Want to Parse XML with Linq. Here is My XML Data. <?xml version=1.0
Well I have this XML here, <?xml version=1.0?> <!DOCTYPE reviews SYSTEM bookstore.dtd> <bookstore> <location>Port
i want to extract some text in certain website. here is web address what
Here's my scenario: <!-- Normal Control --> <div class=required> <label for=address1>Address line 1</label> <input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.