First time coding in PHP and I hate it. It's an inconsistent clusterfuck.
1+"1" is ok and returns int but "str"+"str" is an error and you have to use . and if you do "1"+"1" it's ok and turns into an int
There are also multiple ways to do the same. To convert a number to a string you can either cast it or use use strval()
:pepeDread:

@matrix 1+"1" or "1" + "1" is addition
"str" . "str" is a concatenation

Lua has the .. op for concatenation, and I think some other languages do the same or similar

@applejack I understand. I hate the implicit retyping. Logically "1" + "1" should throw an error because you are trying to put together two strings.

Follow

@matrix I think if you have separate operators it's not that bad, otherwise it's more typing

· · Web · 0 · 0 · 1
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.