在PHP中的点运算符(Dot operator in PHP)

编程入门 行业动态 更新时间:2024-10-14 04:25:14
在PHP中的点运算符(Dot operator in PHP)

我以为我认识字符串操作符 . 直到今天我被问及一个关于它的问题。 这个问题看起来很简单:

echo 100...100;

乍一看,我认为这会造成语法错误。 但是当我运行代码并看到结果时,我完全困惑。 结果是

1000.1

所以我想知道这是怎么发生的?

谢谢。

I thought I've known the String Operator . well enough until I was asked a question about it today. The question looks quite simple:

echo 100...100;

At the first glance I thought it would make a syntax error. But when I ran the code and saw the result I was totally confused. The result is

1000.1

So I wonder how could this happen?

Thanks.

最满意答案

像这样读取它:

(100.) . (.100)

因此它连接100和0.1 。

Read it like this:

(100.) . (.100)

Thus it concats 100 and 0.1.

更多推荐

本文发布于:2023-08-04 09:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413934.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:运算符   PHP   operator   Dot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!