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

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -