note 127624 added to language.operators.string

From: Date: Wed, 14 Sep 2022 10:31:07 +0000
Subject: note 127624 added to language.operators.string
Groups: php.notes 
Request: Send a blank email to php-notes+get-219568@lists.php.net to get a copy of this message
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 ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.173 (proxied: 77.234.87.253) ---- Manual Page -- https://php.net/manual/en/language.operators.string.php Edit -- https://main.php.net/note/edit/127624 Del: integrated -- https://main.php.net/note/delete/127624/integrated Del: useless -- https://main.php.net/note/delete/127624/useless Del: bad code -- https://main.php.net/note/delete/127624/bad+code Del: spam -- https://main.php.net/note/delete/127624/spam Del: non-english -- https://main.php.net/note/delete/127624/non-english Del: in docs -- https://main.php.net/note/delete/127624/in+docs Del: other reasons-- https://main.php.net/note/delete/127624 Reject -- https://main.php.net/note/reject/127624 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219568) next »