User Tools

Site Tools


programmieren:grundlagen:logical_operators

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
programmieren:grundlagen:logical_operators [2026/11/12 16:22] – [String] adminprogrammieren:grundlagen:logical_operators [2026/11/12 16:36] (current) – Added Types and Array admin
Line 258: Line 258:
  
 $a = $a . $b; // $a = 'Foobar' $a = $a . $b; // $a = 'Foobar'
 +
 +// Assignment
  
 $a .= $b; // $a = 'Foobar' $a .= $b; // $a = 'Foobar'
Line 263: Line 265:
 </code> </code>
  
-I should totally expand this list+===== Array ===== 
 + 
 +<code php> 
 +// Union 
 + 
 +$a = ["a" => "apple", "b" => "banana"]; 
 +$b = ["a" => "pear", "b" => "strawberry", "c" => "cherry"]; 
 + 
 +$c = $a + $b; // $c = ["a" => "apple", "b" => "banana", "c" => "cherry"]. Any keys that already exist in the previous array are ignored 
 +</code> 
 + 
 +===== 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 
 + 
 +</code>
  
programmieren/grundlagen/logical_operators.txt · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki