note 105182 added to function.is-numeric

From: Date: Tue, 02 Aug 2011 00:02:05 +0000
Subject: note 105182 added to function.is-numeric
Groups: php.notes 
Request: Send a blank email to php-notes+get-182081@lists.php.net to get a copy of this message
This code will allow you to use the is_numeric function and the modulus conditional operator to find even numbers. It's a bit large but will do the trick. <?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/105182 Del: integrated -- https://master.php.net/note/delete/105182/integrated Del: useless -- https://master.php.net/note/delete/105182/useless Del: bad code -- https://master.php.net/note/delete/105182/bad+code Del: spam -- https://master.php.net/note/delete/105182/spam Del: non-english -- https://master.php.net/note/delete/105182/non-english Del: in docs -- https://master.php.net/note/delete/105182/in+docs Del: other reasons-- https://master.php.net/note/delete/105182 Reject -- https://master.php.net/note/reject/105182 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182081) next »