Re: [PHP-DEV] base64_encode without padding

2024-03-14 Thread Dik Takken
On 13-03-2024 17:06, Remi Collet wrote: I think padding should be optional (on by default to keep BC) Of course in user land, simple to write   $enc = trim(base64_encode('foo'), '='); This proposal allow to simply use   $enc = base64_encode('foo', PHP_BASE64_NO_PADDING); And also expose

[PHP-DEV] Re: [RFC] OOP API for cURL extension

2024-02-15 Thread Dik Takken
On 14-02-2024 19:47, Sara Golemon wrote: Good afternoon folks, I'd like to open discussion on adding OOP APIs to the cURL extension. https://wiki.php.net/rfc/curl-oop This has been a long standing bug-bear of mine, and I think its time has come. try { (new \CurlHandle)->setOpt(YOUR_VOTE,

Re: [PHP-DEV] Custom object equality

2023-10-24 Thread Dik Takken
On 23-10-2023 22:07, Jordan LeDoux wrote: I don't quite follow. The interface would cause the engine to use the result of an `equals()` function on the object if it implements an interface as part of `zend_compare`? Internally there is no `==` function, there is only the equivalent of `<=>`. To

Re: [PHP-DEV] Custom object equality

2023-10-23 Thread Dik Takken
On 23-10-2023 18:34, Larry Garfield wrote: Jordan's RFC explained in detail why interfaces are not viable, which is why we have to use magic methods (with or without a special keyword) instead: https://wiki.php.net/rfc/user_defined_operator_overloads#why_not_interfaces (Seriously, it has an

Re: [PHP-DEV] Custom object equality

2023-10-23 Thread Dik Takken
On 18-10-2023 14:50, someniatko wrote: This approach allows combining - no BC break - `~=` is a new syntax which is unavailable in older PHP versions - explicitly showing an intent that objects are compared using a custom comparison, rather than standard PHP one - allow to skip writing

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-09 Thread Dik Takken
On 08-05-2023 23:38, Larry Garfield wrote: Ilija Tovilo and I would like to offer another RFC for your consideration. It's been a while in coming, and we've evolved the design quite a bit just in the last week so if you saw an earlier draft of it in the past few months, I would encourage

Re: [PHP-DEV] Allowing NULL for some internal functions

2022-03-02 Thread Dik Takken
TypeError | TypeError | coerced internal | 0 | coerced| Deprecated | coerced Is this correct? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Allowing NULL for some internal functions

2022-02-28 Thread Dik Takken
ome a lot easier to write "internal" functions in PHP rather than C. Not only will that make developing the standard library easier, it may also make the optimizer and JIT compiler more effective. The more consistency the better. Approaches 2 and 3 from the RFC are a step in the right direc

Re: [PHP-DEV] Long-Term Planning for PHP 9.0 Error Promotion

2022-01-27 Thread Dik Takken
: $a = [...$b]; Perhaps these oddities / inconsistencies are good candidates for addressing in PHP 9.0? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] User Defined Operator Overloads (v0.6)

2021-12-15 Thread Dik Takken
this creative use of operator overloading in the current RFC. It may however be useful to consider if this use case could be supported by a future RFC in a backward compatible way. Perhaps the RFC could mention it as a possible future extension. Kind regards, Dik Takken -- PHP Internals - PHP R

Re: [PHP-DEV] Revisiting Userland Operator Overloads

2021-08-23 Thread Dik Takken
ession, which gets passed to the filter() method. So basically, this would allow for writing expressions in plain PHP and have them translated into other languages under the hood. The use case does require that operator overloads are allowed to return any kind of value they wish. Regards, Dik

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-06 Thread Dik Takken
work authors. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] is_literal

2021-06-18 Thread Dik Takken
in which it is used. Elevating some user input to the same level of security as literals is not ideal. On the other hand, as Craig pointed out to me (thanks!), a feature that is too much of a hassle to use may not be widely adopted and the goal of the proposal (improving security) may not be met. Regar

Re: [PHP-DEV] Re: [RFC] is_literal

2021-06-17 Thread Dik Takken
nt on the name ‘is_hard_coded’, if we allow integers, > that means that it’s no longer strictly hard coded, and might get confusing. > Ah, I was assuming that you were still strictly referring to integer literals, not variables containing integers. Then indeed the name would be confus

Re: [PHP-DEV] Re: [RFC] is_literal

2021-06-16 Thread Dik Takken
`is_constrained()`, as > the value has limited sources. But I'd also welcome more suggestions, and > am happy to set up a poll (thanks Dharman for the strawpoll.com suggestion). Throwing in another idea: is_hard_coded(). > I've also updated the RFC Future Scope to note how this could be a >

Re: [PHP-DEV] [RFC] is_literal

2021-06-14 Thread Dik Takken
ew type match the name of the function that checks for it. In case the existing 'string' type would be paired with a new 'lstring' type the existing is_string() would pair nicely with a new is_lstring() function. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Policy for procedural style in new additions

2021-06-07 Thread Dik Takken
dural APIs where it makes sense sounds like a great step into the right direction. Historical oddities in the OO APIs could be dealt with later. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] New in initializers

2021-05-11 Thread Dik Takken
base class basically contains default implementations of magic methods like __init__(). So the use of "new" in initializers would require extending this base class and call the parent constructor. Maybe forgetting to do so could throw, preventing initializers from silently not working.

Re: [PHP-DEV] [RFC] Property accessors

2021-05-04 Thread Dik Takken
e a huge win for the engine and the language long-term. Would killing it imply that the following example from the RFC: $test->prop[] = 42; behaves differently depending on 'prop' being either a regular class property or a property with associated get accessor? Regards, Dik Takken -- PHP

Re: [PHP-DEV] [RFC] Property accessors

2021-05-04 Thread Dik Takken
in general. The complexity may very well be worth it when fully considering the impact it could have on how the language is used. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Allow commit() without transaction?

2021-04-12 Thread Dik Takken
ce would be to have a separate commit method or a method parameter to explicitly allow committing without an active transaction. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-16 Thread Dik Takken
orator. While this is not nice, it is expected because a Python decorator actually replaces the original function at run time. A PHP implementation would probably not do that, so maybe it could actually work like in scenario 2? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailin

Re: [PHP-DEV] Proposal: short_var_export($value, bool $return=false, int $flags=0)

2021-01-20 Thread Dik Takken
e the __repr() method would be confusing. So I would like to suggest not to use that name. As the intent of the resulting string is to obtain PHP code that will construct the variable, another option might be: var_constructor(). Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailin

Re: [PHP-DEV] PHP 8 release announcement page on php.net

2020-10-14 Thread Dik Takken
languages, how they set up their sandbox environments. > If we need hosting for that, I work for a hosting company and we're happy to > help. I think we all highly appreciate that offer. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] RFC: execution opcode file without php source code file

2020-10-01 Thread Dik Takken
h the exact PHP version and configuration that can run it reliably. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Re: Attributes and constructor property promotion

2020-09-30 Thread Dik Takken
us more time to think this through in stead of deciding in a hurry. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] PHP 8.0 branch cut - The Return

2020-09-29 Thread Dik Takken
On 29-09-2020 14:17, Remi Collet wrote: > I think parameter names (public API) still can change in next RC > as named parameters are not yet widely used. How about warning promotions? My own impression is that we are 99% there but not quite 100%. Regards, Dik Takken -- PHP Internals

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-03 Thread Dik Takken
hidden variable in stead of the programmer explicitly creating a visible one. Ok, now just say "That's nonsense" and I will shut up. :) Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-03 Thread Dik Takken
use cases: foreach, destructuring and function parameters. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-03 Thread Dik Takken
analysis tools, which helps us catch more bugs earlier. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread Dik Takken
On 02-09-2020 21:31, Dik Takken wrote: > Even if we decide that it is not worth the trouble for foreach loops, > there are other cases where this new syntax can work well. Array > destructuring has already been mentioned. Replying to myself: It just occurred to me that array destructurin

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread Dik Takken
ion foo($arg, void) {} This indicates that the second parameter is intentionally left unused. Perhaps it is a good idea to generalize the RFC to the general concept of "using void to intentionally ignore a variable". Maybe pick just one use case for actual implementation and extend later using

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread Dik Takken
we are talking about using underscore in places where a variable name is expected, there may not be any problem at all. But we should be aware of all cases in which ambiguous syntax could emerge and identify any issues. So thanks a lot for pointing out this possible trouble maker! Regards, Dik Tak

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread Dik Takken
efer '_' over 'void' because of consistency with other languages. However, we should also consider that: 1. It is currently a valid constant name (BC break) 2. It might be ambiguous in some contexts in which we may want to use it in the future. We should carefully consider other possible use cases lik

Re: [PHP-DEV] [RFC] Global functions any() and all() on iterables

2020-09-01 Thread Dik Takken
use a comprehension here. Maybe the following will be possible in PHP at some point: any(foreach $itemMap as $enabled => $itemId yield $enabled && meetsAdditionalCondition($itemId)) Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Global functions any() and all() on iterables

2020-09-01 Thread Dik Takken
nctions gradually replace the good old array functions in the future. When that happens, I would rather not have the iter_ prefixes. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Proposal: Adding functions any(iterable $input, ?callable $cb = null, int $use_flags=0) and all(...)

2020-08-30 Thread Dik Takken
the general problem of lacking iterable support in PHP. Perhaps that could be the subject of a followup RFC. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] The @@ is terrible, are we sure we're OK with it?

2020-07-22 Thread Dik Takken
On 22-07-2020 18:51, Derick Rethans wrote: > This is something that STV is specifically designed to solve. You rank > in order by preference. And @@, <<>>, and #[] were all three options. > > In your example, these people would have marked @@ as first, <<>> as > second, and #[] as third. Ah,

Re: [PHP-DEV] The @@ is terrible, are we sure we're OK with it?

2020-07-22 Thread Dik Takken
; >> the result could turn out differently. The only way to know is to take another vote. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

[PHP-DEV] PR: Bump libxml version, deprecate libxml_disable_entity_loader()

2020-07-16 Thread Dik Takken
://github.com/php/php-src/pull/5867 Please have a look. Thanks, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC][DISCUSSION] Language Constructs Syntax Changes

2020-07-13 Thread Dik Takken
On 05-07-2020 09:35, Michał Marcin Brzuchalski wrote: > The proposal is to allow two statements to skip parentheses so they don't > look like expressions. I like small improvements like this one. They may not look like much but they do add up to arrive at a cleaner language in the long run.

Re: [PHP-DEV] [RFC] Property write visibility

2020-06-29 Thread Dik Takken
sing the existing mechanism of declaring the accessor method as protected or private. So perhaps an attribute-based approach provides a nice alternative path for gradually improving object ergonomics. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Dik Takken
d be a major step. It could be extended in subsequent 8.x releases. We should not hijack this thread to discuss this though. Larry, since you got this started again, I guess the honor is yours to write an opening post and start a new thread? ;) Regards, Dik Takken -- PHP Internals - PHP Run

Re: [PHP-DEV] Improving PHP's Object Egonomics: A broad analysis

2020-03-24 Thread Dik Takken
ase > of "write-once" properties. Indeed. For that purpose I would prefer a keyword for marking a public property as read-only. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC]

2020-02-15 Thread Dik Takken
would be that an 'enclosure' construct along the lines of array_map({i18n_translate}, $array) array_map({$object->method}, $array) has better chances of succeeding but you never know what happens. Perhaps you could team up with Michał and use the feedback from this thread to produce an RFC. Reg

Re: [PHP-DEV] [RFC]

2020-02-15 Thread Dik Takken
these would need to become reserved class constant names just like 'class'. Otherwise foo::fn or foo::function is ambiguous when both a function and a class named 'foo' are in scope. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http:/

Re: [PHP-DEV] [RFC]

2020-02-15 Thread Dik Takken
me before: Seeing the scope resolution operator being used on something that is not a class or object looks strange to me. Especially given the resemblance with the built-in 'class' constant that classes have, this looks like functions being used as if they are classes... Regards, Dik Takken --

Re: [PHP-DEV] [RFC]

2020-02-13 Thread Dik Takken
refer getting rid of these awkward array constructs altogether though and just write $synonymSuggester->analyze in stead. This requires a context that only accepts methods, which is what $() or {} could provide. As a side note, I would love to have a name for these closure producing constructs we are talking about. Maybe: 'enclosure'? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC]

2020-02-13 Thread Dik Takken
nfusing in my opinion, the two class constants are too similar. I would rather prefer: foo::function — Returns name of function foo::closure — Returns closure for function Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC]

2020-02-11 Thread Dik Takken
h almost identical name (https://wiki.php.net/rfc/short_closures). Has it not been discussed before? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC]

2020-02-11 Thread Dik Takken
On 11-02-2020 20:20, Dan Ackroyd wrote: > On Tue, 11 Feb 2020 at 19:08, Dik Takken wrote: > >> $($obj->Fot); >> However, wrapped inside $(), which only accepts >> functions and methods > > I don't think I meant that. I think it still should accept varia

Re: [PHP-DEV] [RFC]

2020-02-11 Thread Dik Takken
to reference function names; it's really ugly to do functional code in PHP otherwise, or even just dynamic function logic within a namespace. If I never have to write $fn = __NAMESPACE__ . '\a_func' again, it will be too soon. :-) Perhaps Larry can convince us all to go for something like $() by pos

[PHP-DEV] PHP 7.5

2020-02-06 Thread Dik Takken
then, deprecations warnings and notices can be accumulated in 7.5 as part of the PHP 8 development process. RFCs that target PHP 8 can include changes to 7.5 to sketch a viable migration path. Thoughts? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe

Re: [PHP-DEV] Add viable long running execution model to php 8

2020-01-25 Thread Dik Takken
g about sequential request handling in a single shared memory environment. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Add viable long running execution model to php 8

2020-01-25 Thread Dik Takken
nd is available in the next. This would allow retaining the current shared-nothing architecture while offering the means to break the rules in a well defined way. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Static return type

2020-01-09 Thread Dik Takken
ame type, but NOT $this. > So, a promise that we really get a new object which we can modify without > changing the original object. > > I don't know how we would express this. Perhaps ": clone", but this would > be too specific imo, because whether it is a clone is an implementation > detail. Maybe ": new" ? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: file_cache is prone to some configuration changes

2019-11-24 Thread Dik Takken
e architecture related things. I would have expected that much - if not all - of the output of phpinfo() would be included in the hash for example. Better be safe than sorry. Would that be a sane thing to do? Are there any reasons why this is currently not done? Thanks, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] Union Types v2

2019-11-07 Thread Dik Takken
minary results when you're ready to share them. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] Union Types v2

2019-11-02 Thread Dik Takken
think we can expect the cost to decrease while the gain increases. Or am I too optimistic here? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] Union Types v2

2019-10-30 Thread Dik Takken
On 30-10-19 22:22, Mark Randall wrote: > I don't know if this post has been accidentally sitting in an outbox for > a bit too long and has just sent, but the vote has been underway for a > while now. Thanks, I simply missed that. :) -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] Re: [RFC] Union Types v2

2019-10-30 Thread Dik Takken
a little before starting the vote to show the cost going down as more optimization work is done. Just to build confidence with those who are hesitant to give it their approval. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Optional pre-compiler for PHP8?

2019-10-29 Thread Dik Takken
Type checking opcodes are actually removed by opcache when its static analysis can prove that the type check will always pass. It has some limitations but the functionality is all there. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Reclassifying some PHP functions warning as exceptions

2019-10-24 Thread Dik Takken
n by using the following inspection hint: /* @noinspection PhpUnhandledExceptionInspection */ Since exceptions should mostly be used for situations where it is best to run for the emergency exit, wrapping a function call in a try / catch is not expected to be something done frequently. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Reclassifying some PHP functions warning as exceptions

2019-10-24 Thread Dik Takken
that wraps any function calls that need it in a try() to retain old behavior. Backporting try() to PHP 5.x would allow the same code to run on both PHP 5 and 8. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Reclassifying some PHP functions warning as exceptions

2019-10-24 Thread Dik Takken
parison. Still, my code is not cluttered with exception handling. So, converting a ton of warnings to exceptions in PHP does not worry me at all. I would welcome it, but not as a bulk operation. I agree that we need to ask the question for each case. I would still prefer the answers to bias towards

Re: [PHP-DEV] Reclassifying some PHP functions warning as exceptions

2019-10-21 Thread Dik Takken
functions that are expected to cause bigger BC issues which could be fixed using an automatic fixer. Yet another RFC for functions that would require manual fixing of BC issues. Some of these functions might require an RFC of their own. A step at a time. Regards, Dik Takken -- PHP Internals - PH

Re: [PHP-DEV] Build instructions for Ubuntu 18.04 (and other systems)

2019-09-15 Thread Dik Takken
On 15-09-19 22:53, Gabriel Caruso wrote: > > > The main problem with Docker and php-src is that we need to touch the OS in > order to make sure the new features and bugfixes will be compatible. > > Docker create a layer on top of that, right? > Correct. Honestly I was not considering the use

Re: [PHP-DEV] Build instructions for Ubuntu 18.04 (and other systems)

2019-09-15 Thread Dik Takken
on Github and Docker Hub. This image could even have the command to run the tests baked into the image itself. Then, anyone can just run docker run php-tests:7.4 to build the sources and run the tests. For development you can mount your local git clone in the container. Regards, Dik Takken

Re: [PHP-DEV] Re: Call for participation: Annotating internal function argument and return types

2019-08-27 Thread Dik Takken
ody is working on yet and I will see what I can do. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Call for participation: Annotating internal function argument and return types

2019-08-12 Thread Dik Takken
Hi, I'd be happy to donate some time to this effort as well. If you just assign me a file or directory (not too much at once please) I can create a PR that covers that part of the code base. Would that work for you? Regards, Dik On 10-08-19 12:56, Nikita Popov wrote: > Hi, > > Lack of type

Re: [PHP-DEV] [RFC] Desire to move RFC add_str_begin_and_end_functions to a vote

2019-06-29 Thread Dik Takken
used in regular text, IHMO. The PHP standard library already has a number of methods that are named that way, like str_word_count(). So, I would favor to have str_starts_with(). Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Strict operators directive

2019-06-27 Thread Dik Takken
e switch statement: Array keys are compared using the === operator. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Strict operators directive

2019-06-26 Thread Dik Takken
argue that it is a case of implicit use of an operator. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Calling array_merge / array_merge_recursive without arguments

2019-06-01 Thread Dik Takken
On 23-05-19 21:18, Nikita Popov wrote: > On Thu, May 23, 2019 at 9:02 PM Dik Takken wrote: > >> For array_intersect(), I was actually considering to allow zero >> arguments. The use case I have in mind is to determine the common >> elements in a set of z

Re: [PHP-DEV] Calling array_merge / array_merge_recursive without arguments

2019-06-01 Thread Dik Takken
in PHP 8 3. Allow passing zero arrays to array_map() in PHP 8 Do these changes require an RFC? Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Calling array_merge / array_merge_recursive without arguments

2019-05-23 Thread Dik Takken
On 21-05-19 10:29, Nikita Popov wrote: > This one makes sense in theory, because array_map(null, ...$arrays) is a > way to perform a zip operation in PHP. Unfortunately there is an ugly > special case if there is only a single array, which makes this not actually > usable in practice, unless you

Re: [PHP-DEV] Calling array_merge / array_merge_recursive without arguments

2019-05-18 Thread Dik Takken
On 17-05-19 22:52, G. P. B. wrote: > > So as a side note aren't there maybe some other array functions which > behave like this? > Good point. I did a quick scan of the source code and came up with a list of possible candidates for a similar treatment: array_map() array_diff() & friends

[PHP-DEV] Calling array_merge / array_merge_recursive without arguments

2019-05-17 Thread Dik Takken
to proceed. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC Draft: Comprehensions

2019-03-22 Thread Dik Takken
On 21-03-19 16:22, Larry Garfield wrote: > OTOH, if we just have the one syntax: > > [foreach $foo as $bar yield $bar*2] // gives a generator > > And include a nicer "fast-forward" operator than interator_to_array(), then > we automatically get: > > ...[foreach $foo as $bar yield $bar*2] //

Re: [PHP-DEV] RFC Draft: Comprehensions

2019-03-14 Thread Dik Takken
as $user) yield $user->firstName]) Just thinking out loud here... Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC Draft: Comprehensions

2019-03-14 Thread Dik Takken
ns fit in anywhere. Then there are the cases where you want to access the output of the comprehension multiple times. This may be expensive when a comprehension is a generator. So I still think that using a comprehension to create an array isn't an off chance but a common use case. Regards, Dik Takken -- P

Re: [PHP-DEV] RFC Draft: Comprehensions

2019-03-13 Thread Dik Takken
r it's not always easy to quickly figure out which > part belongs where. Delimiting it would make it easier IMHO, and also > allows again to carry over the intuition of how foreach() and if() work > from already known constructs. Only, the intuition of how "foreach" and "if" works does not fully apply due to the limited syntax of comprehensions. For example, you can't pair the "if" with an "else" in the current proposal. Maybe that could be supported as well, but that is not my point. If comprehensions start looking like familiar foreach loops but do not work the same way, would that not be confusing? Kind regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php