php - Respect\Validation - validate string if not empty, otherwise return true -


i'm using respect\validation validate fields. of fields not mandatory, phone number, if not empty must validated. following current code:

v::phone()->validate($phonenumber); // should return true if $phonenumber empty 

how it?

based on the docs, looks should be:

v::optional(v::phone())->validate($phonenumber); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -