aptitude
This section contains Aptitude Questions and Answers on PHP Numbers.
本节包含有关PHP数字的能力问题。
Yes
No
Correct answer: 1
Yes
Yes, PHP supports automatic type conversion.
是
没有
正确答案:1
是
是的,PHP支持自动类型转换。
is_int()
isint()
isinteger()
None of the above
Correct answer: 1
is_int()
The is_int() function is used to check a variable contains an integer number.
is_int()
isint()
isinteger()
以上都不是
正确答案:1
is_int()
is_int()函数用于检查包含整数的变量。
<?php
$num = 1234;
var_dump(is_integer($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)” 。
<?php
$num = 1234;
var_dump(is_integer($num));
$num = 12.34;
var_dump(is_integer($num));
?>
bool(true)
bool(false)
bool(true) bool(false)
Error
Correct answer: 3
bool(true) bool(false)
The above code will print "bool(true) bool(false)" on the webpage.
布尔值(true)
布尔值(false)
bool(true)bool(false)
错误
正确答案:3
bool(true)bool(false)
上面的代码将在网页上打印“ bool(true)bool(false)” 。
is_int()
is_integer()
is_long()
is_short()
Correct answer: 4
is_short()
The is_short() function is not available in PHP.
is_int()
is_integer()
长()
是短()
正确答案:4
是短()
is_short()函数在PHP中不可用。
is_float()
is_double()
is_longdouble()
is_integer()
Correct answer: 3
is_longdouble()
The is_longdouble() function is not available in PHP.
is_float()
is_double()
is_longdouble()
is_integer()
正确答案:3
is_longdouble()
is_longdouble()函数在PHP中不可用。
<?php
$num = 12.34;
var_dump(is_double($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)” 。
<?php
$num = 12.34F;
var_dump(is_double($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 3
Error
The above code will generate an error.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:3
错误
上面的代码将产生错误。
<?php
$num = 12.34;
var_dump(is_float($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)” 。
<?php
define("COUNTRIES", ["INDIA","AUSTRALIA","USA"]);
echo COUNTRY[1];
?>
Yes
No
Correct answer: 1
Yes
Yes, the is_float() function is alias of is_double() function in PHP.
是
没有
正确答案:1
是
是的, is_float()函数是PHP中is_double()函数的别名。
is_finite()
is_infinite()
isfinite()
isinfinite()
Options:
Only A
Only B
A and B
C and D
Correct answer: 3
A and B
The is_finite() and is_infinite() functions are used to check numbers infinity in PHP.
is_finite()
is_infinite()
isfinite()
isinfinite()
选项:
只有一个
只有B
A和B
C和D
正确答案:3
A和B
is_finite()和is_infinite()函数用于检查PHP中的数字无穷大。
<?php
$num = 1234;
var_dump(is_nan($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 2
bool(false)
The above code will print "bool(false)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:2
布尔值(false)
上面的代码将在网页上打印“ bool(false)” 。
<?php
$num = "ABC";
var_dump(is_numeric($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 2
bool(false)
The above code will print "bool(false)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:2
布尔值(false)
上面的代码将在网页上打印“ bool(false)” 。
<?php
$num = "123";
var_dump(is_numeric($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)” 。
<?php
$num = "123.45";
var_dump(is_numeric($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)” 。
int
integer
intval
int_val
Options:
A and B
A and C
A, B, and C
A, B, C, and D
Correct answer: 3
A, B, and C
The int, integer, and intval are used for type conversion in PHP.
整型
整数
间隔
int_val
选项:
A和B
A和C
A,B和C
A,B,C和D
正确答案:3
A,B和C
int , integer和intval用于PHP中的类型转换。
<?php
$num1 = "123";
$num2 = int($num1);
echo $num2;
?>
123
"123"
Error
None of the above
Correct answer: 3
Error
The above code will generate a syntax error.
123
“ 123”
错误
以上都不是
正确答案:3
错误
上面的代码将生成语法错误。
<?php
$num1 = "123";
$num2 = intval($num1);
echo $num2;
?>
123
"123"
Error
None of the above
Correct answer: 1
123
The above code will print "123" on the webpage.
123
“ 123”
错误
以上都不是
正确答案:1
123
上面的代码将在网页上打印“ 123”。
<?php
$num1 = "123";
$num2 = integer($num1);
echo $num2;
?>
123
"123"
Error
None of the above
Correct answer: 3
Error
The above code will generate a syntax error.
123
“ 123”
错误
以上都不是
正确答案:3
错误
上面的代码将生成语法错误。
<?php
$num1 = "123";
$num2 = (integer)$num1;
echo $num2;
?>
123
"123"
Error
None of the above
Correct answer: 1
123
The above code will print "123" on the webpage.
123
“ 123”
错误
以上都不是
正确答案:1
123
上面的代码将在网页上打印“ 123” 。
<?php
$num1 = "ABC";
$num2 = (int)$num1;
echo $num2;
?>
123
0
Error
None of the above
Correct answer: 2
0
The above code will print "0" on the webpage.
123
0
错误
以上都不是
正确答案:2
0
上面的代码将在网页上打印“ 0” 。
<?php
$num1 = "ABC";
$num2 = intval($num1);
echo $num2;
?>
123
0
Error
None of the above
Correct answer: 2
0
The above code will print "0" on the webpage.
123
0
错误
以上都不是
正确答案:2
0
上面的代码将在网页上打印“ 0” 。
<?php
$num = "123" + 45;
var_dump(isnumeric($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 3
Error
The above code will generate a syntax error.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:3
错误
上面的代码将生成语法错误。
<?php
$num = "123" + 45;
var_dump(is_numeric($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)” 。
<?php
$num = "ABC";
var_dump(is_nan($num));
?>
bool(true)
bool(false)
Error
None of the above
Correct answer: 4
None of the above
The above code will print "NULL" on the webpage.
布尔值(true)
布尔值(false)
错误
以上都不是
正确答案:4
以上都不是
上面的代码将在网页上显示“ NULL” 。
翻译自: https://www.includehelp.com/php/numbers-aptitude-questions-and-answers.aspx
aptitude