Hi can i ask for help pls.

I have this xml values from a given xml file
i wanted to retrieved it from there and when
I was trying to retrieved it and echo it out
it shows the correct value together with the
decimal values. But when the i used the value
for the computation and echo out the result
it only shows the whole number so it omitted the
decimal values and didn't include it in the

I was wandering if you guys has an idea
on what is happening on this process or
if anyone already encountered this problem

thank you hope to hear from you guys .
this is my code

this the php code the bottom part is the computation that im talking about

$xml = simplexml_load_file("test.xml");
$price = 0.00;
$prod_num = 0;
$apple = 0.00;
$orange = 0.00;
$pear = 0.00;
$lemon = 0.00;

foreach($xml->products->children() as $child)
	$products_node = $xml->products->product[$prod_price]->attributes();
	foreach($products_node as $p_attrib)
		if ($prod_num<3)
		$p_name = $prod_num." -  ".$p_attrib;
			if($prod_num == 1)
					$object = $p_attrib;
				 	$price = $p_attrib;	
					//do nothing	

	 //this is a double declaration variable
	 $$object = $price;
	 echo "<li>".$object. "=". $price."</li>";
  echo $price + $price;


and this is the xml file that im talking about

<?xml version="1.0" encoding="utf-8"?>

	<transaction customer="Janakan" object ="apple" />
	<transaction customer="david" object ="orange" />
	<transaction customer="Janakan" object ="pear" />
	<transaction customer="James" object ="orange" />
	<transaction customer="James" object ="lemon" />
	<transaction customer="david" object ="orange" />
	<transaction customer="david" object ="pear" />
	<transaction customer="david" object ="apple" />
	<transaction customer="James" object ="apple" />
	<transaction customer="Janakan" object ="lemon" />
	<transaction customer="Nancy" object ="pear" />
	<transaction customer="Kate" object ="orange" />
	<transaction customer="Janakan" object ="apple" />
	<transaction customer="Nancy" object ="lemon" />
	<transaction customer="Kate" object ="orange" />
<product object="apple" price="3.99"/>
<product object="lemon" price="1.50"/>
<product object="pear" price="5.00"/>
<product object="orange" price="2.30"/>
5 Years
Discussion Span
Last Post by alfiechiong
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.