On the Exakat blog there's a new post sharing some of the weird operators in PHP that you may have not known existed. These are ones outside of the normal =
or .
that can really do some odd things.
If you read the PHP documentation, you will learn about a ton of operators. If you haven’t learnt about PHP operators, go do that first, we’ll wait for you.Operators are usually made up with strange symbols, like !, -, =>, <=>, ^ or ~. Really, some are plain readable like and, while some are merely an missed attempt at being readable, and actually hide a double personnality, like xor.
You probably think you know PHP’s documentation in and out, but there is always more to learn. So I dove deep into the core of PHP code, and looked some special PHP operators that are lesser known, but very useful in your daily coding.
There's ten of the odd operators on their list including:
- the "b" operator for strings
- the "left object" operator
- constant names with
*
and%
Check out the full post for the details (and code examples) on each of these and more.