doukuanyong1939
doukuanyong1939
2015-10-01 13:37

有人能解释Php中奇怪的行为吗? [关闭]

  • syntax
  • php

This is not possible in Python:

Python 2.7.3
[GCC 4.7.2] on linux2
>>> b = 15
>>> a = 15 + b = 16
  File "<stdin>", line 1
SyntaxError: can't assign to operator
>>>

I can test the same in C, C++, Java and JavaScript...

var b=15 ; var a = 15+ b = 15
VM155:2 Uncaught ReferenceError: Invalid left-hand side in assignment(…)

But can someone explain me why this works in Php, and why?

php -r '$b = 15; $a = "45". $b = 15;'
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐