|
|
|
| есть массив большой
Array
(
[7725694006] => Array
(
[0] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 02.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 03.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[6] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[7] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[8] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[9] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[10] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[11] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.05.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[12] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.06.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[13] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[14] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[15] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[16] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[17] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[18] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.05.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[19] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.06.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[20] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.07.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[21] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[22] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[23] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[24] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[25] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[26] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.05.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[27] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.06.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[28] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.07.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[29] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.08.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[30] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.09.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[31] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.11.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[32] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.12.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[33] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[34] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[35] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[36] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[37] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[38] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 08.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[39] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 09.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[40] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 10.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[41] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 11.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[42] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 12.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[43] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 13.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
)
)
[7729716902] => Array
(
[0] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 01.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 02.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 03.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[6] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[7] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[8] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[9] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[10] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[11] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.05.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[12] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 04.06.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[13] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[14] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[15] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[16] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[17] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[18] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.05.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[19] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.06.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[20] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 05.07.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[21] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[22] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[23] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[24] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[25] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[26] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.05.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[27] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.06.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[28] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.07.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[29] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.08.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[30] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.09.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[31] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.11.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[32] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 06.12.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[33] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[34] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.01.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[35] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.02.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[36] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.03.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[37] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 07.04.
[ks] => 1
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[38] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 08.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[39] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 09.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[40] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 10.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[41] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 11.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[42] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 12.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
[43] => SimpleXMLElement Object
(
[@attributes] => Array
(
[workid] => 13.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0
)
)
)
)
[7728586640] => Array
|
и так далее
помогите его по группе разобрать к примеру чтобы получилось
7725694006 и потом все значений которые входят в него
[workid] => 01.
[ks] => 0
[oo] => 0
[ao] => 0
[cl] => 0 | |
|
|
|
|
|
|
|
для: dirol
(10.02.2015 в 11:59)
| | Перефразирую:
- Мне в лом. Сделайте за меня? | |
|
|
|
|
|
|
|
для: Sfinks
(10.02.2015 в 14:14)
| | НЕТ
просто не получается(((
/
/ move the pointer to the first product
while ($xml_reader->read() && $xml_reader->name != 'member');
// loop through the products
while ($xml_reader->name == 'member'){
// load the current xml element into simplexml and we’re off and running!
$xml = simplexml_load_string($xml_reader->readOuterXML());
// now you can use your simpleXML object ($xml).
echo $xml->idNumber."<br />";
echo iconv_c($xml->fullName)."<br />";
$id=$xml->idNumber;
$ccc[''.$id.''][] = $xml->xpath('certificates/certificate/listWorks/work');
$xml_reader->next('member');
}
// don’t forget to close the file
$xml_reader->close();
|
вот здесь массив этот $ccc
foreach ($ccc as $key2 => $movie ) {
$cid_list = array ();
foreach ($movie as $key => $value ) {
echo $key." - ".$value[0]."<br>";
print_r($value);
}
//$tags = array ();
foreach ($cid_list as $key => $value2 ) {
//$tags[] = $value2;
}
}
|
не получается отдельно вывести выводится все скомпом | |
|
|
|
|
|
|
|
для: dirol
(10.02.2015 в 15:13)
| | подскажите хотябы как [workid] выводить | |
|
|
|
|
|
|
|
для: dirol
(10.02.2015 в 15:14)
| |
<?php
$new_arr = array();
foreach($arr as $key => $val){
$new_arr[$key] = array();
foreach($val[0] as $xml_object){
$attrs = array();
foreach($xml_object->attributes() as $attr_name => $attr_val){
$attrs[$attr_name] = $attr_val;
}
$new_arr[$key][] = $attrs;
}
}
|
Кажись так. Но пишу прямо в браузере, возможны опечатки.
P.S. $arr - это ваш исходный массив | |
|
|
|
|
|
|
|
для: Sfinks
(10.02.2015 в 16:13)
| | Спасибо большое за помощь!
все ок работает | |
|
|
|
|
|
|
|
для: dirol
(10.02.2015 в 15:13)
| | Вот это, т.е. когда приведен не работающий код - это "не получается".
А то что было вначале, т.е. только исходные данные - это "сделайте за меня".
=) | |
|
|
|
|
|
|
|
для: dirol
(10.02.2015 в 11:59)
| | | |
|
|
|