Question:
PHP question. What is the result of: 3+4*6?
sokol p
2013-10-31 23:29:22 UTC
A simple php question

What is the result of: 3+4*6?
Thanks
Four answers:
Jeff P
2013-11-01 07:28:45 UTC
echo 3+4*6;
vikas
2013-11-01 08:29:15 UTC
27
Jim
2013-11-01 09:14:36 UTC
don't go there. parenthesize your expressions so you don't have to ask! the order of operations is not guaranteed in any language. so just get used to that coding practice and you will eliminate a lot of confusion and needless unit-testing by everyone who tries tries to read/maintain your code!



most programmer's editors and even dreamweaver has a brackets matcher in it of some sort. make use of it if you get in too deep to see your way out and use variables to simplify the math by breaking the problem down.
?
2013-11-01 06:50:59 UTC
it should be 27



In calculator you may get 42


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...