Re: [PHP-DEV] Union type casts

2022-10-04 Thread Stephen Reay
> On 5 Oct 2022, at 12:41, Dusk wrote: > > On Oct 4, 2022, at 21:46, Eugene Sidelnyk wrote: >> $foo = (int|float)$bar; > > As written, I wouldn't know what to expect this to do with a string value -- > would it cast it to int or float? > > Based on the behavior of your second example, th

Re: [PHP-DEV] Union type casts

2022-10-04 Thread Eugene Sidelnyk
As I mentioned before, it would work the same alike way as if we called function with such type-hint. FMPOV, one of the most meaningful use-cases would be nullable casts (like casting `?string` into `?float` for example). Regards, Yevhen On Wed, Oct 5, 2022, 8:41 AM Dusk wrote: > On Oct 4, 202

Re: [PHP-DEV] Union type casts

2022-10-04 Thread Dusk
On Oct 4, 2022, at 21:46, Eugene Sidelnyk wrote: >$foo = (int|float)$bar; As written, I wouldn't know what to expect this to do with a string value -- would it cast it to int or float? Based on the behavior of your second example, the answer appears to be "float", so this syntax seems to b

[PHP-DEV] Union type casts

2022-10-04 Thread Eugene Sidelnyk
Hello internals! I'm wondering if there are any plans for union type casts support. That's basically what I mean: ```php function checkItOut(int|float|string $bar) { $foo = (int|float)$bar; var_dump($foo); } ``` I assume the behavior should be the same as if we called the function havin

Re: [PHP-DEV] Experimental features

2022-10-04 Thread David Rodrigues
Hi Flávio and Hans! > Could this be done through extensions instead of having to develop a new process/support code? I believe it is possible, however, the main part of the idea would be that "common users" could try out the features without having to know how to install extensions, while there i

Re: [PHP-DEV] Experimental features

2022-10-04 Thread Hans Henrik Bergan
sounds like that's been done with PECL previously yeah? PECL json until native json_encode in PHP5.2.0, PECL PDO until native PDO in PHP 5.1.0, PECL ZendOpcache until native opcache in PHP 5.5.5 etc? On Wed, 5 Oct 2022 at 00:38, Flávio Heleno wrote: > > On Tue, Oct 4, 2022, 17:43 David Rodrigues

Re: [PHP-DEV] Experimental features

2022-10-04 Thread Flávio Heleno
On Tue, Oct 4, 2022, 17:43 David Rodrigues wrote: > I wanted to suggest the possibility of introducing experimental features to > PHP. > > This is an old thread I guess, but I think it's good to reevaluate the > situation from time to time, as other languages already do this to some > extent and

[PHP-DEV] Experimental features

2022-10-04 Thread David Rodrigues
I wanted to suggest the possibility of introducing experimental features to PHP. This is an old thread I guess, but I think it's good to reevaluate the situation from time to time, as other languages already do this to some extent and PHP doesn't. Some platforms/languages (Node, Kotlin) and librar

Re: [PHP-DEV] Sanitize filters

2022-10-04 Thread Claude Pache
Hi, > FILTER_SANITIZE_ENCODED > FILTER_SANITIZE_SPECIAL_CHARS See https://www.php.net/manual/en/function.filter-input.php Example #1 for an example of use. Apparently, “escaping” is considered as part of “sanitizing”? If you want to ed

Re: [PHP-DEV] Sanitize filters

2022-10-04 Thread Rowan Tommins
On 04/10/2022 01:38, David Gebler wrote: What about FILTER_VALIDATE_EMAIL which is notorious for being next to useless? [...] Seems to me like there could at the very least be a plausible case for some better [...] is_valid_email() etc. type functions in core to replace some of the filter API.