Jump to content

Dealing with negative numbers


lanu

Recommended Posts

<?php

if ($beyondportal % 26 == 0 || $beyondportal == 0){ ?>

MY CONTENT

<?php } ; ?>

 

 

This code compares my variable $beyondportal and if it is a multiple of 26 counting up from 0, it prints my content.

 

This is great but sometimes the number comes up a negative that is a multiple counting down from 0 like  -26, -52, etc..

 

if I could do the opposite of a modulus I would think it would work but I'm not sure how to in php. any suggestions?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.