I would like to print out "depth 17 - 1 enclosed by 20m contour "
Below is xml string loaded from a xml file version 1.0 by $xml = simplexml_load_file("test.xml");
<object>
depth
<emphasis>
17
<subscript>1</subscript>
</emphasis>
enclosed by 20m contour
</object>
print_r($Vals->object);
//prints "depth enclosed by 20m contour "
$Vals->object->emphasis.' - '.$Vals->object->emphasis->subscript
//prints "17 - 1"
I can print string by replacing the values "depth" with depth $Vals->object->emphasis.' - '.$Vals->object->emphasis->subscript. Its not the good thing becoz there may also have a ‘depth’ in string and also width may have at the location of depth.
Till now i am trying with below code, Saw at Go to Question
echo dom_import_simplexml($Vals->object)->textContent;
This code could not do the job and also make the system to so slow. No error generating.
You are looking for strval.
Given this code:
You can do:
And so on, you can combine them yourself to the string you want.