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

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -