The solution to this was to avoid using fractional numbers, and instead, using this:
$price = $stockingPrice * 10 / 7;
Search found 9 matches
- Thu Apr 22, 2010 12:19 pm
- Forum: PHP - Code
- Topic: Error Calculating With Decimals
- Replies: 4
- Views: 680
- Thu Apr 22, 2010 10:38 am
- Forum: PHP - Code
- Topic: Error Calculating With Decimals
- Replies: 4
- Views: 680
Error Calculating With Decimals
I'm running into a very strange issue where very cut and dry math is getting distorted by PHP. Here's the function: private function GetListPrice($stockingPrice) { $price = $stockingPrice / .7; $decimal = $price - floor($price); if ($price > 100) return ceil($price); else { if ($decimal <= .5) retur...
- Thu Nov 19, 2009 2:49 pm
- Forum: PHP - Code
- Topic: PHP Overriding Cache-Control Header
- Replies: 2
- Views: 125
- Fri Nov 13, 2009 9:02 am
- Forum: PHP - Code
- Topic: PHP Overriding Cache-Control Header
- Replies: 2
- Views: 125
PHP Overriding Cache-Control Header
I've been fighting an issue with PHP to disable caching on pages so that users are clicking the back button and seeing old data, or seeing anything they shouldn't once a user logs out. Here's the headers I'm setting: Header( "Cache-Control: no-cache", true); // HTTP/1.1 Header( "Dat...
- Fri Sep 18, 2009 12:41 pm
- Forum: PHP - Code
- Topic: XML Text Node with an Attribute
- Replies: 6
- Views: 269
Re: XML Text Node with an Attribute
I figured it out! For any XML nodes like this, the value needs to be represented with a '_' in either the array, or as a class property. Here's my PHP class: class Money { public $_; public $currency; public function __construct($value, $currency) { ...
- Fri Sep 18, 2009 9:02 am
- Forum: PHP - Code
- Topic: XML Text Node with an Attribute
- Replies: 6
- Views: 269
Re: XML Text Node with an Attribute
I don't believe this issue is with the web service. Here's the SOAP from soapUI or WSStudio(another web service tester): <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.myapp.com/"> <soapenv:Header /> <soapenv:Body> <ws:MoneyTest>...
- Thu Sep 17, 2009 3:02 pm
- Forum: PHP - Code
- Topic: XML Text Node with an Attribute
- Replies: 6
- Views: 269
Re: XML Text Node with an Attribute
Here is a scaled down version of my code, with only the Money node. $strWsdlUrl = "http://localhost/WebService.asmx?WSDL"; $client = new SoapClient($strWsdlUrl); $MoneyTest = array('Money' => new Money('40.00', 'USD')); $client->MoneyTest($MoneyTest); class Mo...
- Thu Sep 17, 2009 1:25 pm
- Forum: PHP - Code
- Topic: XML Text Node with an Attribute
- Replies: 6
- Views: 269
Re: XML Text Node with an Attribute
You're right, the .NET code is just so I had as much info as possible. The .NET app simulates the web service endpoint, and that's what the Money class it generated looks like. Sorry if that's confusing anyone. :) I also don't need to use objects, but I just prefer to so that I'm not using arrays of...
- Thu Sep 17, 2009 7:49 am
- Forum: PHP - Code
- Topic: XML Text Node with an Attribute
- Replies: 6
- Views: 269
XML Text Node with an Attribute
I'm working on taking some PHP classes and serializing them into XML. Rather than using arrays, I'm just using classes with public properties named the same as the XML nodes. This is working perfectly until I get to a XML text node that has an attribute attached to it. Here's an example: <Money curr...