Extracting a string
How do i put a string
10000000779460 5 10000000779461 One
The data in the OrderNo and orderresult tags are all extracted. Put into two arrays, respectively?
------Solution--------------------
$str = "
10000000779460
5
10000000779461
"
;
htm
Preg_match_all ("/< ([^>]+) > ([^<]+) <\/\\1>/u", $str, $matches);
$out = Array ();
foreach ($matches [1] as $key = + $value) {
$out [$value] = $matches [2][$key];
}
Var_dump ($out);
------Solution--------------------
Not a standard XML output, is it?
$s = " 10000000779460 5 10000000779461 One ";
$a = simplexml_load_string ($s);
Print_r ($a);
------Solution--------------------
XML file Operations
$SIMXML = simplexml_load_file (' Xmlpath ');
Remove OrderNo
erNo = Array ();
{
erNo [] = (string) er; Convert directly to string storage
}
Remove Orderresult
erResult = Array ();
{
erResult [] = (string) $res;//convert directly into string storage, can also be converted to other;
}
Simple XML operation don't know if it's what you want
------Solution--------------------
$s =<<< TXT
10000000779460
5
10000000779461
One
TXT;
$d = Array (' OrderNo ' = ' array_order ', ' orderresult ' = ' arraresult ');
Preg_match_all (' #< (OrderNo
------Solution--------------------
Orderresult) > (. +)
#U ', $s, $r);
foreach ($r [1] as $i = $k) ${$d [$k]}[] = $r [2][$i];
Print_r ($array _order);
Print_r ($arraresult);
Array
(
[0] = 10000000779460
[1] = 10000000779461
)
Array
(
[0] = 5
[1] = 11
)