php - validate directly in your if or create a function? -


the question kinda hard put in words hope make sense

what's best practice?

this

if($value < 5) {     //do } 

or this

if(validvalue($value)) {     //do }  function validvalue($value) {     if($value < 5) return true; } 

this best way validate value rather creating function that's not required.

if ( $value < 5 )   {    #do   } 

Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -