#webdev #php type juggling

#webdev #php type juggling and casting and converting to int


<!--?php

PHP
echo 'is_int'.PHP_EOL;
echo is_int(1).PHP_EOL;
echo is_int('1').PHP_EOL;
echo is_int('a').PHP_EOL;
echo is_int('1234').PHP_EOL;
echo 'is_numeric'.PHP_EOL;
echo is_numeric(1).PHP_EOL;
echo is_numeric('1').PHP_EOL;
echo is_numeric('a').PHP_EOL;
echo is_numeric('1234').PHP_EOL;
echo intval(420000000000000000000).PHP_EOL; // 0
echo intval('420000000000000000000').PHP_EOL; // 2147483647

RETURNS

is_int
1
-
is_numeric
1
1
-
1
0
9223372036854775807

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s