Re: intval
| From: | Robert Cummings | Date: | Sat, 09 May 2009 13:03:53 +0000 |
| Subject: | Re: intval | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292417@lists.php.net to get a copy of this message | ||
On Sat, 2009-05-09 at 18:22 +0530, kranthi wrote:
> var_dump($_POST['month'], intval($_POST['month']),
> $_POST['month'] ==
> ((int)($_POST['month']));
> var_dump($_POST['month'], intval($_POST['month']),
> $_POST['month'] ==
> (intval($_POST['month'])));
After I fixed your syntax error this worked fine for me in PHP 5.2.9:
string(3) "Jan"
int(0)
bool(true)
string(3) "Jan"
int(0)
bool(true)
<?php
$_POST['month'] = 'Jan';
var_dump( $_POST['month'], intval( $_POST['month'] ), $_POST['month']
==
(int)$_POST['month'] );
var_dump( $_POST['month'], intval( $_POST['month'] ), $_POST['month']
==
intval( $_POST['month'] ) );
?>
Your use of parenthesis shows you lack understanding of operator and
function use. All those parenthesis generally make things less readable
despite your best intentions to clarify the process.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP