A Quiet Word

ไม่มีอะไรใหม่ภายใต้ดวงอาทิตย์

การแปลง XML เป็น Array อย่างง่าย ๆ กรกฎาคม 18, 2007

Filed under: Computers and Internet — Korkai @ 7:05 am

<?php
$myXML = <<<DATA
<xml>
<node1>data1</node1>
<node2>data2</node2>
<node3>data3</node3>
</xml>
DATA;

$myArray= get_object_vars(simplexml_load_string($myXML));
print_r($myArray);
echo $myArray["node1"]; // data1
echo $myArray["node3"]; // data3
?>

Result

Array
(
[node1] => data1
[node2] => data2
[node3] => data3
)
data1
data3

  Markus10/06/2007 13:30:02   <a href=http://www.google.ca/01.html > T1 </a> [URL=http://www.google.ca/02.html] T2 [/URL] [URL]http://www.google.ca/03.html[/URL] [LINK=http://www.google.ca/04.html] T4 [/LINK] [LINK]http://www.google.ca/05.html[/LINK] http://www.google.ca/06.html LtQTZk
Advertisements
 

3 Responses to “การแปลง XML เป็น Array อย่างง่าย ๆ”

  1. Unknown Says:

    Amberdigital Branch,Southern Stars Enterprises Co is specializing in the development and manufacturing of advertisement screens, LCD digital signage and LCD signages. Established in 1996, we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

    amberdigital Contact Us
    Southern Stars Enterprises Co (Hong Kong Office)
    Add:3 Fl, No.2, Lane 2, Kam Tsin Tsuen, Sheung Shui, Hong Kong
    Tel:+852 2681 4099
    Fax:+852 2681 4586
    Southern Stars Enterprises Co (Shenzhen Office)
    Add:DE, 16/F, Building 2, Nanguo Tower, Sungang Road, Shenzhen, China
    Tel:+86 755 2592 9100
    Fax:+86 755 2592 7171
    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[b

  2. Unknown Says:

    Hi,Do you have used lcd screens, lcd monitor used, surplus lcds and scrap LCDs? Please go here:www.sstar-hk.com(Southern Stars).We are constantly buying re-usable LCD panels.The re-usable panels go through strictly designed process of categorizing, checking, testing, repairing and refurbishing before they are re-used to make remanufactured LCD displays and TV sets.Due to our recent breakthrough in testing and repairing technology of LCD, we can improve the value for your LCD panels.
    website:www.sstar-hk.com[iccgjajciaijjj]


ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s