У меня есть этот прекрасный фрагмент текста, найденный внутри элемента XML, и вы хотите преобразовать его в простой массив, XML - от wikia.com.Создайте простой PHP-массив из этого текста
массив будет что-то вроде этого:
card name => [Martial] Ares, character name => Ares, release_date => May 1 2013 and so on..
Я пробовал все виды не взрывается и взрываются вариации, но не повезло .. Это один получил меня в тупик ..
|card name=[Martial] Ares
|character name=Ares
|release_date=May 1 2013
|image 1=MartialAres5.jpg
|rarity 1=Super Special Rare
|pwr req 1=28
|sale price 1=94200
|max card lv 1=60
|max mastery lv 1=40
|quote 1=Ares prefers weapons that were used during the age of Greek myth: sword, axe, and spear. But he can use any weapon expertly, and turn most ordinary objects into lethal weapons.
|base atk 1=2440
|base def 1=2650
|max atk 1=7015
|max def 1=7613
|mastery bonus atk 1=915
|mastery bonus def 1=993
|image 2=MartialAres6.jpg
|rarity 2=Ultimate Rare
|sale price 2=188400
|max mastery lv 2=200
|quote 2=Next time I see Hercules, We're going to have a steel conversation. It's about time for him to answer for massacring my Stymphalian Birds.
|max atk 2=9822
|max def 2=10660
|mastery bonus atk 2=1098
|mastery bonus def 2=1192
|alignment=Bruiser
|ability=Warhawk
|gender=Male
|usage=Average
|faction=Super Hero
|effect=Significantly harden DEF of your Bruisers.
|centretrait=None
Код я пробовал:
if (file_exists('card.xml')) {
$xml = simplexml_load_file('card.xml');
$text = $xml->page->revision->text;
$newtext = explode('|', $text);
foreach($newtext as $newnewtext) {
$newtext2 = explode('=', $newnewtext);
print_r($newtext2);
}
} else {
exit('Failed to open card.xml.');
}
взрывается на трубе \ разрыв линии, петля, взорваться на равных –
Это фрагмент того, что дает мне 'Array ([0] => {{Карта Infobox (2)) Array ([0] => имя карты [1] => [Martial] Ares) Array ([0] => имя персонажа [1] => Ares) ' – CodeX
Редактировать вопрос с кодом пробовал –