PHP Online Compiler
Example: PHP Program to Check Whether a Number is Even or Odd using Conditional Operator
C
C++
C#
Java
Python
PHP
main.php
STDIN
Run
<?php // PHP Program to Check Whether a Number is Even or Odd using Conditional Operator $x = 27; echo "Input Number: ", $x, "\n\n"; $x = $x % 2 == 0 ? 1 : 0; if ($x) { echo "The input number is even number.\n"; } else { echo "The input number is odd number.\n"; } ?>
Output
Clear
ADVERTISEMENTS