Checking string length with strlen

前端 未结 3 1189
别跟我提以往
别跟我提以往 2021-01-29 17:08

I have this code, i want it to check if the length is NOT 32 or 40. The code below only checks if the word is 32 or 40 in length.



        
相关标签:
3条回答
  • 2021-01-29 17:23

    if ($len != 32 && $len != 40)

    try that out

    0 讨论(0)
  • 2021-01-29 17:34

    What about

    if($len != 32 and $len != 40)
    
    0 讨论(0)
  • 2021-01-29 17:34
    <?php
    $name = mysql_real_escape_string($_POST['dgt']);
    $len = strlen($name);
    if ($len != 32 && $len != 40){
    print "This is not a name.";
    } else {
    echo 'This is a name';
    ?>
    
    0 讨论(0)
提交回复
热议问题