Re: intval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux