A
A
Alexander2016-02-04 18:14:06
PHP
Alexander, 2016-02-04 18:14:06

How to form a list of XML elements with the same attributes based on a php array?

There is a numeric array of telephone numbers, it must be converted to an associative array,
so that all elements of the array have the same keys! How can I do that?

// в таком виде массив приходит на PHP скрипт в результате Ajax запроса
$NrList = array(
  0=>'9250999998',
  1=>'9250999911'
);

So you need to form a list of XML elements for the SOAP message.
<NrList>
  <Nr>9200925068</Nr>
  <Nr>9200925069</Nr>
 </NrList>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2016-02-04
@BuriK666

in any way, in an array keys can only be unique.

$NrList = array(
  'Nr'=>'9250999998',
  'Nr'=>'9250999911'
);
This is
array(1) {
  'Nr' =>
  string(10) "9250999911"
}

E
enchikiben, 2016-02-04
@EnChikiben

key cannot be the same

$NrList = array(
  'Nr'=>array('9250999998',
 '9250999911')
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question