PHPverse 2025

Voting

: max(three, zero)?
(Example: nine)

The Note You're Voting On

biziclop
2 years ago
Some bitwise operators (the and, or, xor and not operators: & | ^ ~ ) also work with strings too since PHP4, so you don't have to loop through strings and do chr(ord($s[i])) like things.

See the documentation of the bitwise operators: https://www.php.net/operators.bitwise

<?php var_dump(
(
'23456787654' ^ 'zVXYYhoXDYP'), // 'Hello_World'
('(!($)^!)@$@' | '@ddhfIvn2H$'), // 'hello_world'
('{}~|o!Wo{|}' & 'Lgmno|Wovmf'), // 'Hello World'
(~'<0-14)(98' & '}}}}}}}}}') // 'AMPLITUDE'
); ?>

Live demo: https://3v4l.org/MnFeb

<< Back to user notes page

To Top