jaytea commented on a Page, Basic Bot framework v0.2  -  Jan 03, 2011

i just remembered something: whenever !$identifier is used as an operand in a condition, it isn't actually treated as plaintext. it has the effect of logically reversing the value of $identifier in the following way, and in the given order:

  • $true becomes $false
  • $false becomes $true
  • 0 becomes 1
  • any number becomes 0
  • $null becomes $true
  • any other strings becomes $null

here's an example:

//if (!$null = !$(abc)) { } | echo -a $v1 -- $v2

notice the empty string ($null) becomes $true, and the value 'abc' became $null.

thus if ($2 = !$isalnum) doesn't quite check the value of $2 is literally '!$isalnum' but it is still a far cry away from checking that $2 is not alphanumeric.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.