php数据类型_PHP数据类型能力问题和解答
php数据类型
This section contains Aptitude Questions and Answers on PHP Data Types.
本节包含有关PHP数据类型的 Aptitude问题和解答。
In PHP, variables can store different type of data that is allowed according to PHP data-types.
In PHP, there is no need to use special keywords to specify the data type of variable.
In PHP, we use the 'int' keyword to declare an integer type variable.
We use predefined classes to specify data-types in PHP.
Options:
Only A
Only B
A and B
C and D
Correct answer: 3
A and B
Statements A and B are correct about data-types in PHP.
在PHP中,变量可以存储根据PHP数据类型允许的不同类型的数据。
在PHP中,无需使用特殊关键字来指定变量的数据类型。
在PHP中,我们使用'int'关键字声明一个整数类型变量。
我们使用预定义的类来指定PHP中的数据类型。
选项:
只有一个
只有B
A和B
C和D
正确答案:3
A和B
语句A和B关于PHP中的数据类型是正确的。
String
Array
Object
Resource
Options:
A and B
C and D
A, B, and C
A, B, C, and D
Correct answer: 4
A, B, C, and D
All given data-types are supported by PHP.
串
数组
目的
资源资源
选项:
A和B
C和D
A,B和C
A,B,C和D
正确答案:4
A,B,C和D
PHP支持所有给定的数据类型。
-32768 to 32767
-2,147,483,648 to 2,147,483,647
-128 to 127
None of the above
Correct answer: 2
-2,147,483,648 to 2,147,483,647
In PHP we used 4-bytes integer then its range is from -2,147,483,648 to 2,147,483,647.
-32768至32767
-2,147,483,648至2,147,483,647
-128至127
以上都不是
正确答案:2
-2,147,483,648至2,147,483,647
在PHP中,我们使用4字节整数,则其范围是-2,147,483,648至2,147,483,647。
get_type()
var_type()
var_dump()
getType()
Correct answer: 3
var_dump()
The var_dump() function returns data-type of a variable and its value.
get_type()
var_type()
var_dump()
getType()
正确答案:3
var_dump()
var_dump()函数返回变量的数据类型及其值。
<?php
$num = 256;
var_dump(num);
?>
int(256)
integer(256)
string(3) "num"
None of the above
Correct answer: 3
string(3) "num"
The above code will print a string(3) "num" on the webpage because we did not use the $ symbol with variable name in var_dump() function.
整数(256)
整数(256)
string(3)“ num”
以上都不是
正确答案:3
string(3)“ num”
上面的代码将在网页上打印一个string(3)“ num” ,因为在var_dump()函数中我们没有在变量名中使用$符号。
<?php
$num = 256;
var_dump($num);
?>
int(256)
integer(256)
string(3) "num"
None of the above
Correct answer: 1
int(256)
The above code will print "int(256)" on the web page.
整数(256)
整数(256)
string(3)“ num”
以上都不是
正确答案:1
整数(256)
上面的代码将在网页上打印“ int(256)” 。
<?php
$num = 256;
$num1 = var_dump($num);
echo "num1 is ".$num1;
?>
int(256) num1 is int(256)
int(256) num1 is
Syntax error
None of the above
Correct answer: 2
int(256) num1 is
The above code will print "int(256) num1 is" on the webpage.
int(256)num1是int(256)
int(256)num1是
语法错误
以上都不是
正确答案:2
int(256)num1是
上面的代码将在网页上打印“ int(256)num1 is” 。
<?php
$num = "Hello";
var_dump($num);
?>
string(hello)
string("hello")
string(5) "hello"
None of the above
Correct answer: 3
string(5) "hello"
The above code will print [string(5) "hello"] on the web page.
字符串(你好)
字符串(“ hello”)
string(5)“你好”
以上都不是
正确答案:3
string(5)“你好”
上面的代码将在网页上打印[string(5)“ hello”]。
<?php
$num = 256;
var_dump($num);
$num = "Hello";
var_dump($num);
?>
int(256)
int(256) string(5) "Hello"
int(256) string(3)
syntax error
Correct answer: 2
int(256) string(5) "Hello"
The above code will print [int(256) string(5) "Hello"] on the web page.
整数(256)
int(256)字符串(5)“你好”
int(256)字符串(3)
语法错误
正确答案:2
int(256)字符串(5)“你好”
上面的代码将在网页上打印[int(256)string(5)“ Hello”]。
<?php
$num = true;
var_dump($num);
?>
bool(true)
boolean(true)
bool(4) "true"
boolean(4) "true"
Correct answer: 1
bool(true)
The above code will print "bool(true)" on the web page.
布尔值(true)
布尔值(true)
bool(4)“真”
boolean(4)“ true”
正确答案:1
布尔值(true)
上面的代码将在网页上打印“ bool(true)”。
<?php
$usrArray = array("ABC","PQR","XYZ");
var_dump($usrArray);
?>
array(3) string
array(3) { [0]=> string(3) "ABC" [1]=> string(3) "PQR" [2]=> string(3) "XYZ" }
Syntax error
None of the above
Correct answer: 2
array(3) { [0]=> string(3) "ABC" [1]=> string(3) "PQR" [2]=> string(3) "XYZ" }
array(3)字符串
array(3){[0] =>字符串(3)“ ABC” [1] =>字符串(3)“ PQR” [2] =>字符串(3)“ XYZ”}
语法错误
以上都不是
正确答案:2
array(3){[0] =>字符串(3)“ ABC” [1] =>字符串(3)“ PQR” [2] =>字符串(3)“ XYZ”}
<?php
$usrArray = array("ABC",786,"XYZ");
var_dump($usrArray);
?>
array(3) { [0]=> string(3) "ABC" [1]=> string(3) 786 [2]=> string(3) "XYZ" }
array(3) { [0]=> string(3) "ABC" [1]=> int(786) [2]=> string(3) "XYZ" }
Syntax error
None of the above
Correct answer: 2
array(3) { [0]=> string(3) "ABC" [1]=> int(786) [2]=> string(3) "XYZ" }
array(3){[0] =>字符串(3)“ ABC” [1] =>字符串(3)786 [2] =>字符串(3)“ XYZ”}
array(3){[0] =>字符串(3)“ ABC” [1] => int(786)[2] =>字符串(3)“ XYZ”}
语法错误
以上都不是
正确答案:2
array(3){[0] =>字符串(3)“ ABC” [1] => int(786)[2] =>字符串(3)“ XYZ”}
Yes
No
Correct answer: 1
Yes
In PHP, NULL is also data-type which can have only one value null.
是
没有
正确答案:1
是
在PHP中,NULL也是数据类型,只能有一个值null。
<?php
$x = null;
var_dump($x);
?>
NULL
NULL(4)
NULL(null)
None of the above
Correct answer: 1
NULL
The above code will print NULL on the webpage.
空值
空(4)
NULL(空)
以上都不是
正确答案:1
空值
上面的代码将在网页上显示NULL。
Yes
No
Correct answer: 1
Yes
Yes, we can create a user-defined class in the PHP script.
是
没有
正确答案:1
是
是的,我们可以在PHP脚本中创建一个用户定义的类。
The resource type is used to contain the reference to the function.
The resource type is used to store the reference of external resources.
The resource type is used for the database call.
None of the above
Options:
A and B
B and C
A, B, and C
D
Correct answer: 3
A, B, and C
Statements A, B, and C are correct about resource type in PHP.
资源类型用于包含对该函数的引用。
资源类型用于存储外部资源的引用。
资源类型用于数据库调用。
以上都不是
选项:
A和B
B和C
A,B和C
d
正确答案:3
A,B和C
关于PHP中的资源类型,语句A,B和C是正确的。
<?php
class Sample
{function Sample()
{$Var1 = "India";
}
}
// create an object of Sample class
$obj = new Sample();
echo $obj->$Var1;
?>
India
Error
Correct answer: 2
Error
The above code will generate an error because $Var1 is not a member of the Sample class.
印度
错误
正确答案:2
错误
上面的代码将产生错误,因为$ Var1不是Sample类的成员。
<?php
class Sample
{function Sample()
{$this->$Var1 = "India";
}
}
// create an object of Sample class
$obj = new Sample();
echo $obj->$Var1;
?>
India
Error
Correct answer: 1
India
The above code will generate print "India" on the web page.
印度
错误
正确答案:1
印度
上面的代码将在网页上生成打印“印度”。
<?php
class Sample
{function Sample()
{$this->$Var2 = "Australia";
$this->$Var1 = "India";
}
}
// create an object of Sample class
$obj = new Sample();
var_dump($obj);
?>
object(Sample)#1 (1) { [""]=> string(5) "India" }
object(Sample)#1 (2) { [""]=> string(5) "Australia" }
Error
None of the above
Correct answer: 1
object(Sample)#1 (1) { [""]=> string(5) "India" }
object(Sample)#1(1){[“”] => string(5)“ India”}
object(Sample)#1(2){[“”] => string(5)“ Australia”}
错误
以上都不是
正确答案:1
object(Sample)#1(1){[“”] => string(5)“ India”}
翻译自: https://www.includehelp.com/php/data-types-aptitude-questions-and-answers.aspx
php数据类型
php数据类型_PHP数据类型能力问题和解答相关推荐
- c语言编程输入a是输出为a_C ++编程基本输入,输出,数据类型,声明能力倾向问题和解答...
c语言编程输入a是输出为a This section contains C++ programming Basic Input, Output, Data types, Declaration etc ...
- php变量类型怎么表示,PHP 数据类型_php
php支持8种原始数据类型. 四种标量类型: ? boolean(布尔型) ? integer(整型) ? float(浮点型,也称作 double) http://www.gaodaima.com/ ...
- php泡点,PHP数据类型_PHP教程_编程技术
两相篓儿狗盗棉袄崇兴猛药.馆际麦垅蓝带柔情失密泡点前因信使!小孩女监连山麦道抽筋魔神煤窑,不收莽撞库格祖逖拼版!明艳路单板坯瓯绣供养哩数!轻吹梅树爽利轻贱抛洒年鉴插曲蒙医:北城湿病国税漫坡侧板钳子面嫩 ...
- iOS有哪些数据类型/基本数据类型?
简述 本文主要探究使用OC作为iOS开发语言时,我们能使用哪些数据类型. 一切类型始于C. C语言的类型 基本数据类型: 基本数据类型(fundamental data types)也叫原始数据类型( ...
- python numpy 数据类型为python对象-python numPy模块 与numpy里的数据类型、数据类型对象dtype...
学习链接:http://www.runoob.com/numpy/numpy-tutorial.html 简介: numPy是python语言的一个扩展库,是一个运行非常快的数学库,主要用于数组计算. ...
- R语言数据类型及数据类型判断
R语言数据类型及数据类型判断 目录 R语言数据类型及数据类型判断 从存储角度看R数据类型
- 【C 语言】数据类型本质 ( 数据类型 | 数据类型本质 | 数组地址 | 数组首元素地址 )
文章目录 一.数据类型 二.数据类型本质 ( 数组地址 | 数组首元素地址 ) 一.数据类型 " 数据类型 " 是 数据的抽象 ; 相同类型的数据 , 表示形式相同 , 存储格式相 ...
- 【Flutter】Dart 数据类型 ( dynamic 数据类型 )
文章目录 一. dynamic 数据类型 二. dynamic 变量无法进行语法检查 三. dynamic 变量运行时类型修改 四. 完整代码示例 五. 相关资源 Dart 语言中有 dynamic ...
- html js 添加数据类型,js数据类型判断和转换
8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? 前言 无论笔试还是面试,总会问到数据类型和隐式转换.今天彻底整理一下这块的知识,希望对大家有帮助. 看到下面的题,是不是 ...
最新文章
- 一些有用的资源分享(工具+电子书)
- MySQL SQL的概述
- mysql数据库的环境搭建_数据库学习(一)MySql环境搭建
- 【转】Linux系统编程---dup和dup2详解
- Android编译工具Freeline的使用
- C++_异常6-其他异常特性
- 具有InlfuxDB的Spring Boot和Micrometer第2部分:添加InfluxDB
- 计算机课实验三,成都信息工程学院计算机网络课程实验三
- spring学习(13):使用junit4进行单元测试续
- 十二、Promise的学习笔记(Promise的基本使用、链式编程、all())
- python三种基本的数据类型有_python基本数据类型一
- 疫情趋势下,远程控制软件成为刚需,ToDesk or 向日葵,哪一款最好用?
- C++句柄类 [ 资深博主 ]
- 基于机器学习的文本情感分类
- scrapy 使用无忧代理IP 需要填写无忧代理IP提供的API订单号(请到用户中心获取) 这个是要钱吗??...
- k8s java供应链项目篇
- 天载杠杆炒股A股三大指数团体高开
- 易大师接口自动化测试平台如何创建不同协议的接口并进行测试
- ESP8266 (WEMOS D1 R1 ) + L9110S_FOUR 驱动直流电机
- 记录一下家里双路由实现wifi漫游功能