php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29738 percentages error
Submitted: 2004-08-18 17:40 UTC Modified: 2004-08-18 18:20 UTC
From: support at pulse-hosting dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: Irrelevant OS: Linux RedHat
Private report: No CVE-ID: None
 [2004-08-18 17:40 UTC] support at pulse-hosting dot com
Description:
------------
I can't seem to work out why, but the %() function doesn't always return the right out. For example 25% (40); returns 25 yet 25% of 40 is 15. I've checked and checked again and the error is on php's side and not mine. Other percentages work yet some don't.

Reproduce code:
---------------
$sum = 25% (40);
echo "25% of 40 is ".$sum;

Expected result:
----------------
25% of 40 is 15

Actual result:
--------------
25% of 40 is 25

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-18 18:10 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

There is no "%() function" in PHP.
Check appropriate part of the documentation:
http://www.php.net/manual/en/language.operators.arithmetic.php
 [2004-08-18 18:17 UTC] support at pulse-hosting dot com
Oops, I ment 10, the correct output should be 10 not 15. 25% of 40 is 10
 [2004-08-18 18:20 UTC] support at pulse-hosting dot com
oh sorry :P
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 06:01:35 2024 UTC