by TazeTSchnitzel · 11y ago · 0 comments
In JS, "3" + 4 is "34", in PHP, it's 7. PHP separates concatenation and addition, unlike JS.
Anyway, huh? Lua has automatic type conversion. That's usually considered weak typing.
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> ="3" + 4
7"3"+4 is 7 4.."3" is "43"
"3hello"+4 is an error
I'm not familiar with a rigorous definition of weak typing - but my experience is that weak typing is usually reserved for languages like TCL, Snobol, and even Perl where there's no "type" of values to speak of - everything is equivalent and decoded according to context.