PHP tips and tricks¶
- Class Is A Valid Class
- Float Precision
- Store Float As Index
- Case Insensitive Cast
- $this $this
- No Returntype But Still, Only String
- No Unknown For array_merge()
- No Returntype Enforced
- As As As
- No DNF For Catch
- new On Object
- Unfinished Class Doesn’t Compile
- Yield, Not Return By Reference
- class_exists() With Enums
- No Semicolon In Sight
- glob() With Hidden Files
- file_append_contents()
- array_reduce() To Filter And Alter
- $this Is Not Of The Current Class
- Class Constants With Different Types
- No Change To $this
- file_put_contents() With Array Argument
- Get The Generator
- Redefine Native Functions
- A Static Method Cannot Call A Non Static Method
- Before Or After
- Cast Is So Strong
- Roman Loops
- Finally Catches Exception
- Abstract Again
- Always Compatible Variadic
- Yield, Not Return
- try, catch, finally Are All Optional
- null Or Boolean As Array
- Hide Sensitive Parameter
- No Property In Interface
- Uncallable Function
- Easy Wither Call
- Array Is Full
- Const Without Parenthesis
- Cast Are Case Insensitive
- Array And Object Syntax, Not The Same Error
- When Space Matters
- array array = array()
- Cannot Yield And Never
- Class Invasion Both Ways
- Typed By Enum
- Change A Static Variable Outside Its Function
- Scalar Types Are Unqualified
- array_append() And Short Assignation
- Coalesce And Null
- All Classes Aliases
- Mixed And Untyped Are Not Compatible Types
- Abstract Constants
- Cannot Static Static Property
- More Attribute Usage
- Run Any Script In A Phar
- Static Variable Outside A Method
- Enumeration’s Cases Comparisons
- All Static Curly Syntaxes And One Wrong
- No Such Function As Empty
- Strange –> Operator
- Unexpected keys in array
- Recursive Generator
- Documenting Parameters
- Catch Is Optional
- Void Parameter In array_keys()
- Unsetting Properties Surprises
- Multiple Aliases
- Plus Plus Minus Minus
- Constants Can Be Impossible
- Constants Are Mutable
- Quick DTO Or VO Copy
- Stealth Generator
- Quick Serialize
- Clone Clone Clone
- Set readonly Properties Outside The Class
- Exception Polyphormism
- Exponential Minus One
- PHP Infinity Is Reachable
- Negative Squares
- Negating An Assignation
- Numeric Separators Inside A String?
- Identifier Confusions
- Relaxed Syntax With Const
- Closure To Call
- Get $this In A Static
- array_intersect_uassoc_insensitive() ?
- Class And Constant Confusion
- Don’t Forget To Yield
- Inconsistent Constructor Signatures
- foreach() With All The Same Keys
- Battle Of Definition
- Variadic All The Yields
- Refactoring strpos()
- is_a() Versus Instanceof
- Exporting Properties
- Another Cast To Int
- ReturnTypeWillChange Is For All
- URL As Comments
- Coalesce And Assignation
- Missing Methods Are Fatal
- Only Initialize With Short Assignation Coalesce
- Keys Are Integers Whenever Possible
- Fast Creation Of stdClass Objects
- An Elephpant In The Code
- Internal Static Call
- strict_types Exceptions
- Playing With Integers Limits
- Signature Compatibility Exception
- Object Is Not A Type
- Forgotten Throw
- Keywords In Namespaces
- No Warning For Unused Variables
- Self In An Interface
- instanceof Object
- stdClass Object
- A Case Of Misplaced Parenthesis
- Checking For Names At Different Times
- Integer Becomes Negative
- Not All Strings In Arrays
- Recursive Arrow Function
- null Does Not Always Equal false
- Recursive Closure
- Cast Precedence
- Enum As A Name
- Type Is Not Always Returned
- The Namespace Stack
- Catch On Interfaces