php - IF-Statement Combination with mb_strlen doesn't work -


i have form following if-statement's doesn't work. first verification "if empty" work not second 1 mb_strlen, why?

that's php-code:

elseif(empty($_post['project_title']) or  (mb_strlen($_post['project_title'], 'utf-8') <= 3)){ echo "please correct project title";} 

i don't error. have syntax mistakes in code?

from can tell, code works fine. little test script ran:

<?php  echo test_title( '' ); echo test_title( 'pdf' ); echo test_title( 'this 1 works' );  function test_title( $title ) {     echo "testing '$title'. ";     if( empty( $title ) ||        mb_strlen( $title, 'utf-8') <= 3      ){         return "please correct project title\n";      }     return "looks fine\n"; } 

will output following:

testing ''. please correct project title testing 'pdf'. please correct project title testing 'this 1 works'. looks fine 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -