php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25087 "%" operate
Submitted: 2003-08-13 22:48 UTC Modified: 2003-08-15 07:14 UTC
From: flyruns at hotmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.2 OS: windows 2000 advanced server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: flyruns at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-08-13 22:48 UTC] flyruns at hotmail dot com
Description:
------------
When i use '%' operate when i account can't get my hope;

Reproduce code:
---------------
<?php
 echo  27%13;//  =1

 echo  27%13.5;// =1 (behove is 0)

 echo  27%13.9;// =1 (behove is 13.1)
?>

Expected result:
----------------
account right;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-13 22:50 UTC] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

..

 [2003-08-13 22:57 UTC] flyruns at hotmail dot com
Thanks i find it in c is right~ sorry~
 [2003-08-15 07:14 UTC] sniper@php.net
(Restored this comment due to database got corrupted..)

For the record (for anyone who looks up this "bug" in the future):

% (The modulous operator) is an integer operator.

Using an integer operator with float values will simply get those float values truncated to integers.

Ergo:   27 % 13.5 gets turned into 27 % 13, hence the result value of 1
is correct.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC