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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.