[Ignore this, its nothing] $a / $b Division

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

[Ignore this, its nothing] $a / $b Division

Post by Shendemiar »

Whats wrong?

Code: Select all

if ($i / 2)
        {
        $A="REM=0";
        }
        else
        {
        $A="NOT dividable";
        }
Last edited by Shendemiar on Sat Jan 17, 2004 1:15 pm, edited 1 time in total.
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Post by phpcoder »

What error u r getting ?
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

Never mind, im too tired.

I used $i insted of $j
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Try...

Code: Select all

<?php

    if (is_int($i))
        {
        $A="REM=0";
        }
        else
        {
        $A="NOT dividable";
        } 

?>
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

Sorry about that :oops:

Anyway i found out that / returns float, and is_int is handy so it didnt go in vain... :)
Post Reply