+ 2

Are you kidding me php?

echo 2*"10 some string" will echo out 200 how come is that possible!? this is just wrong...

16th May 2018, 10:43 AM
Abnet
Abnet - avatar
6 Respostas
+ 7
But why would you multiply an integer and a string in the first place?
16th May 2018, 10:51 AM
Toni Isotalo
Toni Isotalo - avatar
+ 5
Abnet your question is only the tip of the iceberg.I know other languages are complex(to say),but php is weird especially when it comes to strings. its only oop i know where you increment strings like:: $a="word"; ++$a;
16th May 2018, 1:01 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
I didn't It popped up in a challenge...
16th May 2018, 11:03 AM
Abnet
Abnet - avatar
+ 2
because it multiplies with the first integer it can find in that string php has a lot of weird interactions like this due to there not being type declarations
16th May 2018, 11:11 AM
hinanawi
hinanawi - avatar
0
very weird! shouldn't they fix this?
16th May 2018, 11:18 AM
Abnet
Abnet - avatar
0
Abnet it's wierd, but not a bug. see, as long as it isn't a syntax error, php will compile it most of the time. but it is an intended interaction
16th May 2018, 11:45 AM
hinanawi
hinanawi - avatar