programmieren:grundlagen:logical_operators
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| programmieren:grundlagen:logical_operators [2026/11/10 15:59] – [Comparison] admin | programmieren:grundlagen:logical_operators [2026/11/12 16:36] (current) – Added Types and Array admin | ||
|---|---|---|---|
| Line 202: | Line 202: | ||
| </ | </ | ||
| + | ===== Logical ===== | ||
| - | I should totally expand this list | + | <code php> |
| + | $a = true; | ||
| + | $b = false; | ||
| + | |||
| + | $a and $b // False | ||
| + | |||
| + | $a or $b // True | ||
| + | |||
| + | $a xor $b // True | ||
| + | |||
| + | $a && $b // False | ||
| + | |||
| + | $a || $b // True | ||
| + | |||
| + | $a = true; | ||
| + | $b = true; | ||
| + | |||
| + | $a and $b // True | ||
| + | |||
| + | $a or $b // True | ||
| + | |||
| + | $a xor $b // False | ||
| + | |||
| + | $a && $b // True | ||
| + | |||
| + | $a || $b // True | ||
| + | |||
| + | $a = false; | ||
| + | $b = false; | ||
| + | |||
| + | $a and $b // False | ||
| + | |||
| + | $a or $b // False | ||
| + | |||
| + | $a xor $b // False | ||
| + | |||
| + | $a && $b // False | ||
| + | |||
| + | $a || $b // False | ||
| + | |||
| + | // Symbols take presedence over words | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== String ===== | ||
| + | |||
| + | <code php> | ||
| + | |||
| + | // Concatenation | ||
| + | |||
| + | $a = ' | ||
| + | $b = ' | ||
| + | |||
| + | $a = $a . $b; // $a = ' | ||
| + | |||
| + | // Assignment | ||
| + | |||
| + | $a .= $b; // $a = ' | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Array ===== | ||
| + | |||
| + | <code php> | ||
| + | // Union | ||
| + | |||
| + | $a = [" | ||
| + | $b = [" | ||
| + | |||
| + | $c = $a + $b; // $c = [" | ||
| + | </ | ||
| + | |||
| + | ===== Types ===== | ||
| + | |||
| + | <code php> | ||
| + | // instanceof | ||
| + | |||
| + | class ParentClass {} | ||
| + | class MyClass extends ParentClass {} | ||
| + | class NotMyClass {} | ||
| + | |||
| + | $a = new MyClass; | ||
| + | $b = new NotMyClass; | ||
| + | $c = new ParentClass; | ||
| + | |||
| + | $a instanceof MyClass // True | ||
| + | $a instanceof NotMyClass // False | ||
| + | $a instanceof ParentClass // True, works with any kind of inheritance | ||
| + | |||
| + | $b instanceof MyClass // False | ||
| + | $b instanceof NotMyClass // True | ||
| + | $b instanceof ParentClass // False | ||
| + | |||
| + | $c instanceof MyClass // False | ||
| + | $c instanceof NotMyClass // False | ||
| + | $c instanceof ParentClass // True | ||
| + | |||
| + | </ | ||
programmieren/grundlagen/logical_operators.1794322776.txt.gz · Last modified: by admin
