Logical Operators for PHP, VBScript, Javascript
Posted by Ken Cheung on Tuesday, May 9, 2006 in General : : commentIn the past, I have worked with javascript, asp/vbscript, coldfusion, and a little bit of perl. Now, I've started working with php. I have to admit, it can get confusing at times (especially if you have to keep going back and forth between them). So, I decided I'm going to start putting together comparison charts for javascript, vbscript, and php (maybe perl and coldfusion down the road, but for now just the three scripting languages). My first chart will be for logical operators.
| operator | vbscript | javascript | php |
| AND | and | && | and && |
| OR | or | || | or || |
| not | NOT | ! | ! |
| XOR | xor | xor |
Operator Precedence:
- vbscript: not and or xor
- javascript: ! && ||
- php: ! && || and xor or
VBScript and Null:
- null and true = null
- null and false = false
- null and null = null
- null or true = true
- null or false = null
- null or null = null
- not null = null
- null xor true = null
- null xor false = null
- null xor null = null
References:
If you found this page interesting, bookmark and share it on:
No comments yet.