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 -

c# - Can I intercept a SOAP response in .NET before a content type binding mismatch ProtocolException? -

css - Can I use the :after pseudo-element on an input field? -