note 129820 added to function.mb-ereg

From: Date: Thu, 24 Oct 2024 15:23:23 +0000
Subject: note 129820 added to function.mb-ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-221611@lists.php.net to get a copy of this message
mb_ereg() cannot match over 100,000 (100K) characters (not bytes but characters) whereas preg_match() can over 1,000,000,000 (1G, if it's within "memory_limit"). Try this. <?php ini_set("memory_limit", "512M"); // <-- must be changed if you try 1G. $length = 100000; // <-- 99999 is OK / 100000 is NG $str = ""; for ($i=0; $i<$length; $i++): $str .= "1"; // <-- same result if it is a multibyte character. endfor; if (mb_ereg('.*', $str)): echo '<br><span style="background-color:lightgreen">OK!</span><br>memory_limit = '.ini_get("memory_limit").'<br>$length = '.$length; else: echo '<br><span style="background-color:orange">NG!</span><br>memory_limit = '.ini_get("memory_limit").'<br>$length = '.$length; endif; ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 153.229.101.182) ---- Manual Page -- https://php.net/manual/en/function.mb-ereg.php Edit -- https://main.php.net/note/edit/129820 Del: integrated -- https://main.php.net/note/delete/129820/integrated Del: useless -- https://main.php.net/note/delete/129820/useless Del: bad code -- https://main.php.net/note/delete/129820/bad+code Del: spam -- https://main.php.net/note/delete/129820/spam Del: non-english -- https://main.php.net/note/delete/129820/non-english Del: in docs -- https://main.php.net/note/delete/129820/in+docs Del: other reasons-- https://main.php.net/note/delete/129820 Reject -- https://main.php.net/note/reject/129820 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221611) next »