Jump to content

dyedblue

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dyedblue's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. In my code ($amtr1=$amt-($amtr2+$amtr3); I use the pre-rounded numbers ($amtr2, $amtr3) to get the first amount. I am using $amt1, $amt2, $amt3 to display the amounts so I don't want to take off the rounding for them, but as far as I can tell I only use the pre-rounding amounts to do the calculations.
  2. I understand what you are saying, but I don't see where my error is.
  3. *Values passed in from form $amt=279.71 $percentage2=40 $percentage3=20 $amt2=111.88 $amt3=55.94 When these numbers are entered I get $amt1=111.88 and it should be $111.89 (279.71 - 167.82)
  4. I have a money vouchering form that users input an invoice amount and select percentages (up to three) that the form calculates the amount from each fund for. It works most of the time but I am being thrown off because of a rounding issue that causes the total of the calculated amounts for the 3 funds not to equal the invoice amount. It is off by $.01. I have the following code and have tried several approaches the latest being to take the sum of the 2nd and 3rd amounts and subtract that from the invoice amount to give me the 1st amount. The 1st amount is still often off by $.01. Is there anyone who has experienced a similar problem that could shed some light on the subject for me or that has an easier approach to my problem? //Calculates the Amounts to be charged to each fund based on percentages entered $percent = 100; //Calculates the second fund amount $percentagecalc2=$percentage2 / $percent; $amtr2=$amt * $percentagecalc2; $amt2 = preg_replace('/([\d,]+.\d{2})\d+/', '$1', $amtr2); $amt2 = number_format($amt2, 2, '.', ','); //Calculates the third fund amount $percentagecalc3=$percentage3 / $percent; $amtr3=$amt * $percentagecalc3; $amt3 = preg_replace('/([\d,]+.\d{2})\d+/', '$1', $amtr3); $amt3 = number_format($amt3, 2, '.', ','); //Calculates the first fund adds penny if needed $amtr1=$amt-($amtr2+$amtr3); $amt1 = number_format($amtr1, 2, '.', ',');
  5. We are exploring the possibility of creating a interface with PHP and XML from another system to query information and display it on our Web site. As far as I can tell the best way to do this is using Sockets, however, when I try to connect to a socket I receive an error at the following lines of code:  if( !function_exists('socket_create') ) {         echo "Sockets are not installed correctly into the php build\n";         exit; } I believe it is because sockets are not enabled in my php setup.  I am using PHP Version 4.3.3 on IIS 5.1.  I have not been able to figure out how to make the socket functions work. I uncommented the ;extension=php_sockets.dll line in the PHP.ini file.  I did notice that in the C:\PHP folder that there is not extensions folder present.  I tried copying an extensions folder into that C:\PHPPHP folder and made the path an absolute path to the Extensions folder containing the .dll files in the PHP.ini file. This did not work either as it still gives me an error that says "Unknown(): Unable to load dynamic library ‘C:/PHP/extensions/php_sockets.dll’ – The specified module could not be found." Can anyone help me out here?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.