Jump to content

[SOLVED] STRLEN Outputting Strangely


Jiblob

Recommended Posts

Hello,

 

I wish to have the verification for my form in in the following form: -

 

if (!$blah) {
   echo "ERROR!";
}
else
{
   echo "FINE!";
}

 

... everything was fine, but then i put used a strlen(); to test that a string is NOT more than or equal to 25, so take this code for instance: -

 

<?php
$var = "111111111111111111111111111111"; // 30 Chars Long Var
if ((!strlen($var) <= 25)) {
echo "Error";
}
else
{
echo "Fine";
}
?>

 

For some reason it tells me that there is an error at any length, when it's only supposed say there is an error if it is over 25 characters in length.

 

Help ???

 

- Luke

Link to comment
https://forums.phpfreaks.com/topic/38546-solved-strlen-outputting-strangely/
Share on other sites

Thanks for the help ShogunWarrior, however, I did not fix it like this.  I was stupid really, there was no need for the !strlen "NOT MORE THAN OR EQUAL TO 25", because this is just equivalent to strlen "MORE THAN 25".

 

Silly me! haha

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.