php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8975 modulo (%) sets the ritht operator to the result
Submitted: 2001-01-29 02:29 UTC Modified: 2001-01-30 19:48 UTC
From: ben at stonehenge-net dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.4pl1 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ben at stonehenge-net dot com
New email:
PHP Version: OS:

 

 [2001-01-29 02:29 UTC] ben at stonehenge-net dot com
$a = 0;
$b = 2;

$c = $a % $b

print($b)

// $b will be set to 0.  does nasty thing to for loops :)

not really sure what was configured at compiletime, was from the FreeBSD ports collection, can dig it up if it's relevant.

same with php.ini.

no gdb, as there's no crash.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-29 19:08 UTC] sniper@php.net
This works for me (tm) just fine.  ie. prints 2.

Could you please try again (with the script below)?

<?php 

$a = 0;
$b = 2;

$c = $a % $b;

print($b);

?>

--Jani
 [2001-01-30 19:48 UTC] phanto@php.net
use == to compare, = is for assignments


if(($i % $rowcount) == 0)
{
   ....
}


harald.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 26 06:01:23 2020 UTC