Welcome to my series on every PHP keyword and its usage. Today’s item: const. This keyword allows you to define a constant (an immutable value, can only be defined once) globally or for a specific class. Values that can be placed into an expression are limited to: Any scalar literal, e.g. true, 7, "green". Any existing constant. An array literal containing any of the above, e.g. [1, 2, 3].
Welcome to my series on every PHP keyword and its usage. Today’s item: callable. This keyword can only be used as a type hint or return type, and indicates that it only accepts or returns a value of the following form: A closure / anonymous function A string with the name of an existing function An array containing an object as its first value and the name of a method as its second value An array containing the name of a class as its first value and the name of a static method as its second value A callable can be run by adding arguments inside brackets to the variable name, e.
Welcome to my series on every PHP keyword and its usage. Today’s item: abstract. The abstract keyword can be used to enforce that a class or method cannot be used directly, but must be extended. An abstract method can only be used inside of an abstract class. When a class is marked abstract, it must be extended. When a method is marked abstract, it must be overridden with the same signature.
While most browsers have responsive emulation available from their web inspector, Safari has a completely separate system available from the debug menu. If you don’t have the debug menu enabled, check the “Show Develop menu in menu bar” checkbox at the bottom of the Advanced tab in Safari’s preferences: Responsive Design Mode can be enabled by using the ^⌘R (control + command + R) shortcut, or by selecting it from the Develop menu:
Welcome to my series on every PHP keyword and its usage. Today’s item: xor. The xor (exclusive or) operator is a logical operator that will result in true if only one of its operands are true. If neither is true, or both of them are true, the result of the expression is false. Example 1 2 3 4 5 6 7 8 <?php // False $a = false xor false; $b = true xor true; // True $c = false xor true; $d = true xor false;