dimanche 19 novembre 2017

Can someone make me understand with this if else PHP code?

I am getting output: "Your number is 49 Your number is 50 Not possible"

But why?What is the if-else statement say in here. How the pre and post increment works here?

<?php

$num = 49;

if($num % 2)
{
    echo "Your number is ";
    echo($num);
}
if($num++ % 3)
{
    echo "Your number is ";
    echo($num);
}
if(++$num % 3)
{
    echo "Your number is ";
    echo($num);
}

else
    echo "Not possible";

Aucun commentaire:

Enregistrer un commentaire