Is it possible to specify multiple types for a function parameter in PHP?
You can specify the type of a variable for a class method.
If I can send a "string", an empty string or nothing (NULL) to my method - how can I specify this?
As always, there is one thing in the title, something completely different in the text
"an empty string" is not a type.
That is, the task is reduced to a string or null
, that is, it’s trite? string
Several types can be set in PHP8, through a wand