作者:Tony_Friday | 来源:互联网 | 2023-08-30 18:16
后端开发|php教程string,int,gettype,float,an后端开发-php教程PHP支持8种原始数据类型。易语言地区源码,vscode滚轮缩放,ubuntu系统怎么
后端开发|php教程
string,int,gettype,float,an
后端开发-php教程
PHP 支持 8 种原始数据类型。
易语言地区源码,vscode 滚轮缩放,ubuntu系统怎么显示桌面,tomcat站点更新,sqlite计算日期差,淘宝同行订单数据插件,前端不用框架搭建项目,异步爬虫的实现,flex php,光头seo,网站公告上下滚动代码,三国网页游戏单机版一键端,车辆买卖模板,职工信息管理系统课程设计,微擎小程序文件名lzw
四种标量类型:(标量类型即为基本类型)
qq群分享源码,ubuntu装sql,tomcat自身的性能优化,google插件爬虫,安卓手机php服务器,广东推荐的seo优化常见问题lzw
boolean(布尔型) integer(整型) float(浮点型,也称作 double) (由于历史原因,float也叫作double,php中没有单精度和双精度之分)string(字符串) (字符串类型在PHP中属于标量类型,在Java中属于类类型)
游戏专区网站源码,vm怎么安装ubuntu,爬虫如何找到api,php 之路,自动seo 源码lzw
两种复合类型:
array(数组)object(对象)
最后是两种特殊类型:
resource(资源)NULL(无类型)
变量的类型通常不是由程序员设定的,确切地说,是由 PHP 根据该变量使用的上下文在运行时决定的。
如果想查看某个表达式的值和类型,用 var_dump() 函数。
如果只是想得到一个易读懂的类型的表达方式用于调试,用 gettype() 函数。要查看某个类型,不要用 gettype(),而用 is_type 函数。
例子:
"; // prints out: booleanecho gettype($a_str)."
"; // prints out: stringecho gettype($an_int)."
"; // prints out: integerecho gettype($a_float)."
"; // prints out: double// If this is an integer, increment it by fourif (is_int($an_int)) { echo"an_int = ".$an_int."
"; $an_int += 4; echo"an_int = ".$an_int."
";}// If $bool is a string, print it out// (does not print out anything)if (is_string($a_str)) { echo"String: $a_str"."
";}echo var_dump($a_float, $a_bool, $a_str, $an_int);?>
输出:
booleanstringintegerdoublean_int = 12an_int = 16String: foofloat(3.14) bool(true) string(3) "foo"int(16)
php手册中对gettype()的解释(请放大查看?):
每种类型的具体使用,请参考PHP的官方手册,我这里也只是抛砖引玉。
‘).addClass(‘pre-numbering’).hide();
$(this).addClass(‘has-numbering’).parent().append($numbering);
for (i = 1; i <= lines; i++) { $numbering.append($(&#039;&#039;).text(i)); }; $numbering.fadeIn(1700);}); });
以上就介绍了PHP学习(4)——数据类型,包括了方面的内容,希望对PHP教学有兴趣的朋友有所帮助。