سؤال

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.

<?
$name = mysql_real_escape_string($_POST['dgt']);
$len = strlen($name);
if (!($len == "32" or $len == "40")){
print "This is not a name.";
} else {
echo 'This is a name';
?>
هل كانت مفيدة؟

المحلول

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

try that out

نصائح أخرى

What about

if($len != 32 and $len != 40)
<?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';
?>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top