I m new in PHP.When I try to store variable in array i got this error ** Array to string conversion ** PHP Code is :
$record = simplexml_load_file('demo.xml');
foreach ($record as $item):
$a=$item->item2->record->p21;
$b=$item->item2->record->bq_21;
echo $arr1 = array($a,$b);
endforeach;
I wants value only ....If print_r is used then its gives this o/p
Array ( [0] => SimpleXMLElement Object ( [0] => 26 ) [1] => SimpleXMLElement Object ( [0] => 1 ) )
I want this only
26 1
$arr1for later use, so just removeechostatement (although $arr1 is overwritten each timeforeachis executed), or if you want to just print result, thenecho $a.' '.$blike this.