G
G
gachkydxvbgd2017-10-26 19:07:01
PHP
gachkydxvbgd, 2017-10-26 19:07:01

How to generate such xml using php?

How to generate such xml using php?

<entry gd:etag="{lastKnownEtag}">
  <id>http://www.google.com/m8/feeds/contacts/{userEmail}/base/{contactId}</id>
  <updated>2008-02-28T18:47:02.303Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/contact/2008#contact"/>
  <gd:name>
    <gd:givenName>New</gd:givenName>
    <gd:familyName>Name</gd:familyName>
    <gd:fullName>New Name</gd:fullName>
  </gd:name>
  <content type="text">Notes</content>
</entry>
</pre>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Ushenin, 2019-07-30
@navodchik131

1. Iterate through the array and replace the value of each element with a subarray containing
2. Sort the resulting array with the uasort function, taking into account the initial values ​​and the added serial numbers.
3. Go through the array again and replace the subarrays back with the original values ​​they contain.

A
Anton R., 2019-07-30
@anton_reut

Output a sorted array from the database at once by specifying Order By ... Asc or Desc in the sql query

M
Maksim Fedorov, 2017-10-26
@gachkydxvbgd

Through SimpleXML you can do

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question