note 105193 added to function.is-numeric
| From: | IvanSpires at osu1 dot php dot net | Date: | Tue, 02 Aug 2011 13:35:13 +0000 |
| Subject: | note 105193 added to function.is-numeric | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182100@lists.php.net to get a copy of this message | ||
While this is quite bulky, this code will let you use the is_numeric and a conditional operator to
find even numbers.
<?php
$w = 2;
$x = 3;
$y = 4;
$z = 5;
echo is_numeric($w) && (($w % 2) == 0) ? "The number $w is even<br/>" :
"The number $w is not even<br/>";
echo is_numeric($x) && (($x % 2) == 0) ? "The number $x is even<br/>" :
"The number $x is not even<br/>";
echo is_numeric($y) && (($y % 2) == 0) ? "The number $y is even<br/>" :
"The number $y is not even<br/>";
echo is_numeric($z) && (($z % 2) == 0) ? "The number $z is even<br/>" :
"The number $z is not even<br/>";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 24.254.196.236
----
Manual Page -- http://www.php.net/manual/en/function.is-numeric.php
Edit -- https://master.php.net/note/edit/105193
Del: integrated -- https://master.php.net/note/delete/105193/integrated
Del: useless -- https://master.php.net/note/delete/105193/useless
Del: bad code -- https://master.php.net/note/delete/105193/bad+code
Del: spam -- https://master.php.net/note/delete/105193/spam
Del: non-english -- https://master.php.net/note/delete/105193/non-english
Del: in docs -- https://master.php.net/note/delete/105193/in+docs
Del: other reasons-- https://master.php.net/note/delete/105193
Reject -- https://master.php.net/note/reject/105193
Search -- https://master.php.net/manage/user-notes.php