Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18430
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "J.O. Aho" <user@example.net> |
| Newsgroups | comp.lang.php |
| Subject | Re: preg_match(): return vualue |
| Date | Sat, 28 Nov 2020 10:57:07 +0100 |
| Lines | 31 |
| Message-ID | <i2el7jFdnmlU1@mid.individual.net> (permalink) |
| References | <rpt2dq$1e5k$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net zIPp9pvnYhU1SL8FnBcd6QKtXGF2Idl7hxqZC9vYtChvyP0Pn8 |
| Cancel-Lock | sha1:sI7p0h7bM7S1BREE+hMWki8hddI= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 |
| In-Reply-To | <rpt2dq$1e5k$1@gioia.aioe.org> |
| Content-Language | en-US-large |
| Xref | csiph.com comp.lang.php:18430 |
Show key headers only | View raw
On 28/11/2020 09.40, alex wrote: > From https://www.php.net/manual/en/function.preg-match.php > Warning This function may return Boolean FALSE, but may also return a > non-Boolean value which evaluates to FALSE. Please read the section on > Booleans for more information. Use the === operator for testing the > return value of this function. > > That is? Put is simply you can get a result that is 0 (no result) or false (error), these two values are equal if you make a simple comparison of the values var_dump(0 == false); // => bool(true) If you need to distinguish between error and no result you need to see if the values are identical var_dump(0 === false); // => bool(false) In theory the error result could happen when you have a string that should match what you are looking for, but also include data that causes the regex to fail. See https://www.php.net/manual/en/language.operators.comparison.php for more information on comparison operators. -- //Aho
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
preg_match(): return vualue alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-11-28 09:40 +0100
Re: preg_match(): return vualue Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2020-11-28 08:46 +0000
Re: preg_match(): return vualue alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-11-28 15:09 +0100
Re: preg_match(): return vualue Allodoxaphobia <trepidation@example.net> - 2020-11-28 18:12 +0000
Re: preg_match(): return vualue "J.O. Aho" <user@example.net> - 2020-11-28 10:57 +0100
Re: preg_match(): return vualue alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-11-28 15:09 +0100
csiph-web