performance - Most efficient php if structure -


What runs fast?

Setting a default value and changing it -

 $ Foo = ""; If ($ bar) {$ foo = "someValue"; } 

or -

 if ($ bar) {$ foo = "someValue"; } And {$ foo = ""; } 

You should not be disturbed by the performance of a single if statement.

Also, consider:

  $ foo = $ bar? "": "Some value"  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -