note 122289 deleted from function.mb-ereg by cmb

From: Date: Thu, 18 Apr 2019 07:36:30 +0000
Subject: note 122289 deleted from function.mb-ereg by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210618@lists.php.net to get a copy of this message
Note Submitter: Never Do This ! ---- Do Not Identically compare (===/!==) "TRUE" with return value of mb_ereg(). eg <?php // This doesn't work. if (mb_ereg('bad', 'bad_input') === true) { // (or) if (mb_ereg('good', 'good_input') !== true) { die('Get out of here !'); }else{ echo 'safe'; // continue processing... } ?> // These work. (not using TRUE) if (mb_ereg('bad', 'bad_input')) {..... if (!mb_ereg('good', 'good_input')) {..... mb_ereg() never returns TRUE, but False (in unmatch case) or Integer (in match case, >=1, which equals TRUE).

« previous php.notes (#210618) next »