Can some help me to convert the below xml data into php array. Thanks in advance.

``````<dataroot>
<content id= "1">
<quest><![CDATA[<FONT FACE="Arial">Which of the following is not the measure of a physical quantity?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">kilogram</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">impulse</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">density</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">kilogram is the name of the fundamental unit of mass</FONT>]]></ans_desc>
</content>
<content id= "2">
<quest><![CDATA[<FONT FACE="Arial">Which of the following sets can enter into the list of fundamental quantities
in any system of units?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">length, mass and velocity</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">length, time and velocity</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">mass, time and velocity</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">length, time and mass</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">velocity cannot enter in this set because it itself involves length and time.</FONT>]]></ans_desc>
</content>
<content id= "3">
<quest><![CDATA[<FONT FACE="Arial">If the unit of force and length are doubled, the unit of energy will be</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">Œ times</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">œ times</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">2 times</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">4 times</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Energy = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
distance = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
length.</P>
<P>When force and length are doubled, the unit of energy will becomes four times
that of its initial value.</P>
</FONT>]]></ans_desc>
</content>
<content id= "4">
<quest><![CDATA[<FONT FACE="Arial">Given that displacement of a particle is given by <img src="Images/Phys1/XLQ680.gif" WIDTH=101 HEIGHT=21 align="absmiddle">
where t denotes the time. The unit of K is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">hertz</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">metre</FONT>]]></opt2>
<opt4><![CDATA[<FONT FACE="Arial">second</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Here K is dimensionless. Thus </P>
</FONT>]]></ans_desc>
</content>
<content id= "5">
<quest><![CDATA[<FONT FACE="Arial">Dimensions of velocity gradient are same as that of </FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">time period</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">frequency</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">angular acceleration</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">acceleration</FONT>]]></opt4>
<ans><![CDATA[b]]></ans>
<P>= [ velocity] / [ distance]</P>
</FONT>]]></ans_desc>
</content>
<content id= "6">
<quest><![CDATA[<FONT FACE="Arial">Which of the following physical quantities is/are dimensionless?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">length</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">time</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">mass</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">all of these</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">all these quantities are dimensionless.</FONT>]]></ans_desc>
</content>
<content id= "7">
<quest><![CDATA[<FONT FACE="Arial">Erg <img src="Images/Phys1/XLQ710.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
sec is the unit of </FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">angle</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">momentum</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">gravitational constant</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">Planck's constant</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">The unit of Planck&#8217;s constant is <img src="Images/Phys1/XLAD710.gif" WIDTH=57 HEIGHT=17 align="absmiddle"></FONT>]]></ans_desc>
</content>
<content id= "8">
<quest><![CDATA[<FONT FACE="Arial">Which of the following have same dimension?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">pressure and density</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">gravitational potential and energy</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">impulse and momentum</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">stress and strain</FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Impulse = force <img src="Images/Phys1/XLAD720.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
time</P>
<P>Momentum = mass <img src="Images/Phys1/XLAD720.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
velocity </P>
</FONT>]]></ans_desc>
</content>
<content id= "9">
<quest><![CDATA[<FONT FACE="Arial">Which of the following pairs of physical quantities will have same dimensional
formula</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">work and couple</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">force and power</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">latent heat and specific heat</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">work and power</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>work = force <img src="Images/Phys1/XLAD730.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
displacement</P>
</FONT>]]></ans_desc>
</content>
<content id= "10">
<quest><![CDATA[<FONT FACE="Arial">Planck&#8217;s constant has same dimension as</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">force</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">linear momentum</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">angular momentum</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD740.gif" WIDTH=114 HEIGHT=17 align="absmiddle"></P>
<P>Angular momentum <img src="Images/Phys1/XLAD742.gif" WIDTH=28 HEIGHT=17 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "11">
<quest><![CDATA[<FONT FACE="Arial">The dimension of Planck&#8217;s constant is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA750.gif" WIDTH=48 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB750.gif" WIDTH=49 HEIGHT=17 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC750.gif" WIDTH=53 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD750.gif" WIDTH=64 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>We know that E=hv</P>
</FONT>]]></ans_desc>
</content>
<content id= "12">
<quest><![CDATA[<FONT FACE="Arial">Dimension of torque is </FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA760.gif" WIDTH=48 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB760.gif" WIDTH=45 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC760.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD760.gif" WIDTH=44 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Torque = force <img src="Images/Phys1/XLAD760.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
distance</P>
</FONT>]]></ans_desc>
</content>
<content id= "13">
<quest><![CDATA[<FONT FACE="Arial">The dimensions of angular velocity is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA770.gif" WIDTH=45 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB770.gif" WIDTH=57 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC770.gif" WIDTH=57 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD770.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>c]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD770.gif" WIDTH=168 HEIGHT=36 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "14">
<quest><![CDATA[<FONT FACE="Arial">If <img src="Images/Phys1/XLQ780.gif" WIDTH=70 HEIGHT=18 align="absmiddle">
<FONT FACE="Arial">were chosen as fundamental units of force, velocity and time
respectively, the dimensions of mass would be represented as </FONT></FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA780.gif" WIDTH=36 HEIGHT=16 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB780.gif" WIDTH=44 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC780.gif" WIDTH=45 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD780.gif" WIDTH=54 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>We know that Force = mass <img src="Images/Phys1/XLAD780.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
acceleration</P>
</FONT>]]></ans_desc>
</content>
<content id= "15">
<quest><![CDATA[<FONT FACE="Arial">If energy E, velocity V and time T are taken as the fundamental units, what
is the dimensional formula for energy per unit area?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">E V T</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB790.gif" WIDTH=54 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC790.gif" WIDTH=57 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD790.gif" WIDTH=56 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD790.gif" WIDTH=81 HEIGHT=36 align="absmiddle">
Here a= 1</P>
<P>Now <img src="Images/Phys1/XLAD791.gif" WIDTH=65 HEIGHT=36 align="absmiddle"></P>
<P>This gives <img src="Images/Phys1/XLAD794.gif" WIDTH=133 HEIGHT=17 align="absmiddle"></P>
<P>So,&#9;&#9;c= -2</P>
</FONT>]]></ans_desc>
</content>
<content id= "16">
<quest><![CDATA[<FONT FACE="Arial">If the volocity of light c, universal gravitational constant G and Planck&#8217;s
constant h be taken as the fundamental units, then the dimentional formula for
mass is.</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA800.gif" WIDTH=54 HEIGHT=25 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB800.gif" WIDTH=54 HEIGHT=25 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC800.gif" WIDTH=54 HEIGHT=25 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD800.gif" WIDTH=44 HEIGHT=22 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Let <img src="Images/Phys1/XLAD800.gif" WIDTH=74 HEIGHT=20 align="absmiddle"></P>
<P>And &#9;<img src="Images/Phys1/XLAD804.gif" WIDTH=88 HEIGHT=17 align="absmiddle"></P>
<P>Solving, we get <img src="Images/Phys1/XLAD805.gif" WIDTH=140 HEIGHT=36 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "17">
<quest><![CDATA[<FONT FACE="Arial">A quantity X multiplied by time gives angular momentum. Then dimensional
formula of X is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA810.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB810.gif" WIDTH=29 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC810.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD810.gif" WIDTH=49 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Angular momentum = m v r</P>
dimensions of angular momentum</P>
</FONT>]]></ans_desc>
</content>
<content id= "18">
<quest><![CDATA[<FONT FACE="Arial">What is the dimensional fromula of <img src="Images/Phys1/XLQ820.gif" WIDTH=29 HEIGHT=20 align="absmiddle">
where the letters have their their usual meanings</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA820.gif" WIDTH=54 HEIGHT=21 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB820.gif" WIDTH=54 HEIGHT=21 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC820.gif" WIDTH=57 HEIGHT=21 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD820.gif" WIDTH=66 HEIGHT=21 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD820.gif" WIDTH=150 HEIGHT=22 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "19">
<quest><![CDATA[<FONT FACE="Arial">Given that <img src="Images/Phys1/XLQ830.gif" WIDTH=68 HEIGHT=20 align="absmiddle">
, where F denotes force and t time, then the dimensions of a and b are respectively.</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA830.gif" WIDTH=101 HEIGHT=22 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB830.gif" WIDTH=62 HEIGHT=20 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC830.gif" WIDTH=85 HEIGHT=20 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD830.gif" WIDTH=129 HEIGHT=20 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD830.gif" WIDTH=74 HEIGHT=20 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "20">
<quest><![CDATA[<FONT FACE="Arial">If K represents kinetic energy, V velocity and T time and these are chosed as the fundamental units then , the
unit of surface tension will be</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA840.gif" WIDTH=56 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB840.gif" WIDTH=58 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC840.gif" WIDTH=62 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD840.gif" WIDTH=58 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD840.gif" WIDTH=157 HEIGHT=22 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
</dataroot>
``````

All 5 Replies

Load data into a variable, like `\$xml` and use SimpleXML:

``````\$data = new SimpleXMLElement(\$xml,LIBXML_NOCDATA);
\$array = json_decode(json_encode(\$data),true);
print_r(\$array);
``````

json_encode/decode will remove the SimpleXML obj.

\$data = new SimpleXMLElement(\$xml,LIBXML_NOCDATA);
\$array = json_decode(json_encode(\$data),true);
print_r(\$array);

Thankyou, I have tried the code, it has thrown a series of errors...

What kind? This works for me:

``````<?php
\$xml = <<<XML
<dataroot>
<content id= "1">
<quest><![CDATA[<FONT FACE="Arial">Which of the following is not the measure of a physical quantity?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">kilogram</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">impulse</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">density</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">kilogram is the name of the fundamental unit of mass</FONT>]]></ans_desc>
</content>
<content id= "2">
<quest><![CDATA[<FONT FACE="Arial">Which of the following sets can enter into the list of fundamental quantities
in any system of units?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">length, mass and velocity</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">length, time and velocity</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">mass, time and velocity</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">length, time and mass</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">velocity cannot enter in this set because it itself involves length and time.</FONT>]]></ans_desc>
</content>
<content id= "3">
<quest><![CDATA[<FONT FACE="Arial">If the unit of force and length are doubled, the unit of energy will be</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">Œ times</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">œ times</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">2 times</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">4 times</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Energy = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
distance = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
length.</P>
<P>When force and length are doubled, the unit of energy will becomes four times
that of its initial value.</P>
</FONT>]]></ans_desc>
</content>
<content id= "4">
<quest><![CDATA[<FONT FACE="Arial">Given that displacement of a particle is given by <img src="Images/Phys1/XLQ680.gif" WIDTH=101 HEIGHT=21 align="absmiddle">
where t denotes the time. The unit of K is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">hertz</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">metre</FONT>]]></opt2>
<opt4><![CDATA[<FONT FACE="Arial">second</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Here K is dimensionless. Thus </P>
</FONT>]]></ans_desc>
</content>
<content id= "5">
<quest><![CDATA[<FONT FACE="Arial">Dimensions of velocity gradient are same as that of </FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">time period</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">frequency</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">angular acceleration</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">acceleration</FONT>]]></opt4>
<ans><![CDATA[b]]></ans>
<P>= [ velocity] / [ distance]</P>
</FONT>]]></ans_desc>
</content>
<content id= "6">
<quest><![CDATA[<FONT FACE="Arial">Which of the following physical quantities is/are dimensionless?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">length</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">time</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">mass</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">all of these</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">all these quantities are dimensionless.</FONT>]]></ans_desc>
</content>
<content id= "7">
<quest><![CDATA[<FONT FACE="Arial">Erg <img src="Images/Phys1/XLQ710.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
sec is the unit of </FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">angle</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">momentum</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">gravitational constant</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">Planck's constant</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">The unit of Planck’s constant is <img src="Images/Phys1/XLAD710.gif" WIDTH=57 HEIGHT=17 align="absmiddle"></FONT>]]></ans_desc>
</content>
<content id= "8">
<quest><![CDATA[<FONT FACE="Arial">Which of the following have same dimension?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">pressure and density</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">gravitational potential and energy</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">impulse and momentum</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">stress and strain</FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Impulse = force <img src="Images/Phys1/XLAD720.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
time</P>
<P>Momentum = mass <img src="Images/Phys1/XLAD720.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
velocity </P>
</FONT>]]></ans_desc>
</content>
<content id= "9">
<quest><![CDATA[<FONT FACE="Arial">Which of the following pairs of physical quantities will have same dimensional
formula</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">work and couple</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">force and power</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">latent heat and specific heat</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">work and power</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>work = force <img src="Images/Phys1/XLAD730.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
displacement</P>
</FONT>]]></ans_desc>
</content>
<content id= "10">
<quest><![CDATA[<FONT FACE="Arial">Planck’s constant has same dimension as</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">force</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">linear momentum</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">angular momentum</FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD740.gif" WIDTH=114 HEIGHT=17 align="absmiddle"></P>
<P>Angular momentum <img src="Images/Phys1/XLAD742.gif" WIDTH=28 HEIGHT=17 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "11">
<quest><![CDATA[<FONT FACE="Arial">The dimension of Planck’s constant is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA750.gif" WIDTH=48 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB750.gif" WIDTH=49 HEIGHT=17 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC750.gif" WIDTH=53 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD750.gif" WIDTH=64 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>We know that E=hv</P>
</FONT>]]></ans_desc>
</content>
<content id= "12">
<quest><![CDATA[<FONT FACE="Arial">Dimension of torque is </FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA760.gif" WIDTH=48 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB760.gif" WIDTH=45 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC760.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD760.gif" WIDTH=44 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Torque = force <img src="Images/Phys1/XLAD760.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
distance</P>
</FONT>]]></ans_desc>
</content>
<content id= "13">
<quest><![CDATA[<FONT FACE="Arial">The dimensions of angular velocity is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA770.gif" WIDTH=45 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB770.gif" WIDTH=57 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC770.gif" WIDTH=57 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD770.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>c]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD770.gif" WIDTH=168 HEIGHT=36 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "14">
<quest><![CDATA[<FONT FACE="Arial">If <img src="Images/Phys1/XLQ780.gif" WIDTH=70 HEIGHT=18 align="absmiddle">
<FONT FACE="Arial">were chosen as fundamental units of force, velocity and time
respectively, the dimensions of mass would be represented as </FONT></FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA780.gif" WIDTH=36 HEIGHT=16 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB780.gif" WIDTH=44 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC780.gif" WIDTH=45 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD780.gif" WIDTH=54 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>We know that Force = mass <img src="Images/Phys1/XLAD780.gif" WIDTH=12 HEIGHT=13 align="absmiddle">
acceleration</P>
</FONT>]]></ans_desc>
</content>
<content id= "15">
<quest><![CDATA[<FONT FACE="Arial">If energy E, velocity V and time T are taken as the fundamental units, what
is the dimensional formula for energy per unit area?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">E V T</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB790.gif" WIDTH=54 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC790.gif" WIDTH=57 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD790.gif" WIDTH=56 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD790.gif" WIDTH=81 HEIGHT=36 align="absmiddle">
Here a= 1</P>
<P>Now <img src="Images/Phys1/XLAD791.gif" WIDTH=65 HEIGHT=36 align="absmiddle"></P>
<P>Or    <img src="Images/Phys1/XLAD792.gif" WIDTH=114 HEIGHT=22 align="absmiddle"></P>
<P>  <img src="Images/Phys1/XLAD793.gif" WIDTH=68 HEIGHT=22 align="absmiddle"></P>
<P>This gives <img src="Images/Phys1/XLAD794.gif" WIDTH=133 HEIGHT=17 align="absmiddle"></P>
<P>So,       c= -2</P>
</FONT>]]></ans_desc>
</content>
<content id= "16">
<quest><![CDATA[<FONT FACE="Arial">If the volocity of light c, universal gravitational constant G and Planck’s
constant h be taken as the fundamental units, then the dimentional formula for
mass is.</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA800.gif" WIDTH=54 HEIGHT=25 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB800.gif" WIDTH=54 HEIGHT=25 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC800.gif" WIDTH=54 HEIGHT=25 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD800.gif" WIDTH=44 HEIGHT=22 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Let <img src="Images/Phys1/XLAD800.gif" WIDTH=74 HEIGHT=20 align="absmiddle"></P>
<P>  <img src="Images/Phys1/XLAD801.gif" WIDTH=229 HEIGHT=22 align="absmiddle"></P>
<P>  <img src="Images/Phys1/XLAD802.gif" WIDTH=168 HEIGHT=21 align="absmiddle"></P>
<P>So,   <img src="Images/Phys1/XLAD803.gif" WIDTH=145 HEIGHT=18 align="absmiddle"></P>
<P>And   <img src="Images/Phys1/XLAD804.gif" WIDTH=88 HEIGHT=17 align="absmiddle"></P>
<P>Solving, we get <img src="Images/Phys1/XLAD805.gif" WIDTH=140 HEIGHT=36 align="absmiddle"></P>
<P>      <img src="Images/Phys1/XLAD806.gif" WIDTH=110 HEIGHT=26 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "17">
<quest><![CDATA[<FONT FACE="Arial">A quantity X multiplied by time gives angular momentum. Then dimensional
formula of X is</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA810.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB810.gif" WIDTH=29 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC810.gif" WIDTH=50 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD810.gif" WIDTH=49 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P>Angular momentum = m v r</P>
dimensions of angular momentum</P>
</FONT>]]></ans_desc>
</content>
<content id= "18">
<quest><![CDATA[<FONT FACE="Arial">What is the dimensional fromula of <img src="Images/Phys1/XLQ820.gif" WIDTH=29 HEIGHT=20 align="absmiddle">
where the letters have their their usual meanings</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA820.gif" WIDTH=54 HEIGHT=21 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB820.gif" WIDTH=54 HEIGHT=21 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC820.gif" WIDTH=57 HEIGHT=21 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD820.gif" WIDTH=66 HEIGHT=21 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[c]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD820.gif" WIDTH=150 HEIGHT=22 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "19">
<quest><![CDATA[<FONT FACE="Arial">Given that <img src="Images/Phys1/XLQ830.gif" WIDTH=68 HEIGHT=20 align="absmiddle">
, where F denotes force and t time, then the dimensions of a and b are respectively.</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA830.gif" WIDTH=101 HEIGHT=22 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB830.gif" WIDTH=62 HEIGHT=20 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC830.gif" WIDTH=85 HEIGHT=20 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD830.gif" WIDTH=129 HEIGHT=20 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[d]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD830.gif" WIDTH=74 HEIGHT=20 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
<content id= "20">
<quest><![CDATA[<FONT FACE="Arial">If K represents kinetic energy, V velocity and T time and these are chosed as the fundamental units then , the
unit of surface tension will be</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLA840.gif" WIDTH=56 HEIGHT=18 align="absmiddle"></FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLB840.gif" WIDTH=58 HEIGHT=18 align="absmiddle"></FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLC840.gif" WIDTH=62 HEIGHT=18 align="absmiddle"></FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial"><img src="Images/Phys1/XLD840.gif" WIDTH=58 HEIGHT=18 align="absmiddle"></FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial"><P><img src="Images/Phys1/XLAD840.gif" WIDTH=157 HEIGHT=22 align="absmiddle"></P>
</FONT>]]></ans_desc>
</content>
</dataroot>
XML;

\$data = new SimpleXMLElement(\$xml,LIBXML_NOCDATA);
\$array = json_decode(json_encode(\$data),true);
print_r(\$array);

?>
``````

<content id= "1">
<quest><![CDATA[<FONT FACE="Arial">Which of the following is not the measure of a physical quantity?</FONT>]]></quest>
<opt1><![CDATA[<FONT FACE="Arial">kilogram</FONT>]]></opt1>
<opt2><![CDATA[<FONT FACE="Arial">impulse</FONT>]]></opt2>
<opt3><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt3>
<opt4><![CDATA[<FONT FACE="Arial">density</FONT>]]></opt4>
<ans><![CDATA[a]]></ans>
<ans_desc><![CDATA[<FONT FACE="Arial">kilogram is the name of the fundamental unit of mass</FONT>]]></ans_desc>
</content>

You have made my day! Thank you. It works like a charm.

You are welcome, bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.