[PHP-DEV] Discussion before submission of array_transpose() RFC

2022-04-23 Thread mickmackusa
matrix in C++? Transpose/Unzip Function (inverse of zip)? Transposing a 2D-array in JavaScript An efficient way to transpose a file in Bash Java: Multi-dimensional array transposing mickmackusa p.s. I've been told that I'll need a sprinkling of karma if I am going to submit an RFC, so please shout me so

Re: [PHP-DEV] Discussion before submission of array_transpose() RFC

2022-04-25 Thread mickmackusa
On Sun, Apr 24, 2022 at 10:24 PM Rowan Tommins wrote: > > On 23/04/2022 23:42, mickmackusa wrote: > > Ideally, PHP should have a native transposing function to put > > developers out of their misery -- much like array_key_last() did. > > > I think a better compa

[PHP-DEV] Character range syntax ".." for character masks

2022-07-08 Thread mickmackusa
example (not just as a user comment at the bottom; this isn't In-N-Out Burger -- put your offerings on the frickin' menu!). mickmackusa

[PHP-DEV] Re: Character range syntax ".." for character masks

2022-07-08 Thread mickmackusa
re is also a `trim`, `ltrim` and `rtrim` functions > > >Суббота, 9 июля 2022, 2:56 +03:00 от mickmackusa : > > > >I've discovered that several native string functions offer a character > mask > >as a parameter. > > > >I've laid out my observations at > >

[PHP-DEV] Character range syntax ".." for character masks

2022-07-28 Thread mickmackusa
On Monday, July 25, 2022, Guilliam Xavier wrote: > On Sat, Jul 9, 2022 at 1:56 AM mickmackusa wrote: > >> I've discovered that several native string functions offer a character >> mask >> as a parameter. >> >> I've laid out my observations at >> ht

[PHP-DEV] Re: Character range syntax ".." for character masks

2022-07-22 Thread mickmackusa
> > > If I seek to have a round of voting for an RFC on character ranges in character mask parameters, should I propose it for PHP8.3 or a higher version? I have only identified 4 native string functions that make reasable candidates to join the 7 existing functions with this feature. I don't

[PHP-DEV] Remove warning when parsing datetime with + symbol?

2022-11-24 Thread mickmackusa
a new property of the datetime object? To programming purists who hate generating notices and warnings, this probably feels like a wart on the language. Please enlighten me. mickmackusa

Re: [PHP-DEV] RFC idea: array_*(Enum)

2023-02-24 Thread mickmackusa
ly, make a habit of implementing the spaceship operator (<=>). See "array_uintersect() gives unexpected results when callback only returns 0 or 1" @ https://stackoverflow.com/q/8176881/2943403 Another example: https://stackoverflow.com/a/71049380/2943403 The deep dive: https://stackoverflow.com/a/70817582/2943403 mickmackusa

Re: [PHP-DEV] Array spread append

2023-04-06 Thread mickmackusa
not yet sold on this new/strange implementation of the spread operator. Mick Harner mickmackusa

Re: [PHP-DEV] Array spread append

2023-04-06 Thread mickmackusa
> > > * Are integer keys preserved? I'm assuming no, as otherwise it would > be the same as `$a + $b`. > > $arr[...] = $arr; > should be the same as > foreach ($arr as $v) { $arr[] = $v; } > > all other answers should be answered from this and consistency Since `$arr1[...] = $arr2;` should be

Re: [PHP-DEV] ??= and function calls

2023-07-06 Thread mickmackusa
belief that the different syntaxes only mattered when echoing. $x = 0; $array1[1] = 43; $array1[++$x] ??= 42; var_dump($x, $array1); echo "\n---\n"; $y = 0; $array2[0] = 43; $array2[$y++] ??= 42; var_dump($y, $array2); Thanks Ilija mickmackusa

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-31 Thread mickmackusa
(increment a counter), concatenate another column (or columns), or otherwise mutate the encountered row in each group. Have you considered the extendability of your pitched function? Without these extra considerations, devs would need to make another pass over the new nested structure. mickmackusa

Re: [PHP-DEV] Possible RFC: PDOStatement::addBatch

2023-06-19 Thread mickmackusa
than using concatenation. I don't see anything ugly or unreadable about building two flat arrays, then using them to construct a SQL string and feed the execute() method. https://phpize.online/s/iW I am not an RFC voter, but I don't really see a compelling reason to add this method to the language. mickmackusa

[PHP-DEV] Declaring new elements as references while destructuring within a foreach() head

2024-01-02 Thread mickmackusa
I want to ask about a quirk that I happened upon. In truth, I expected my code to fail with a fatal error, but it turns out that while using array destructuring in the head of a foreach() loop it is permitted to declare new elements if the value is a reference. Is this a bug or an intended

Re: [PHP-DEV][VOTE][RFC] Add multibyte trim function mb_trim, mb_ltrim and mb_rtrim

2023-11-18 Thread mickmackusa
> > Voting is now closed. mb_trim, mb_ltrim and mb_rtrim of result is yes:15, > no:0. > I will soon change from draft pull request > (https://github.com/php/php-src/pull/12459) to normal pull request. > > Regards > Yuya. > > Hi Yuya, Can you please clear up some ambiguity for me regarding

[PHP-DEV] Proposal: Make $offset of substr_replace null by default

2024-03-23 Thread mickmackusa
hat null values inside of an array are happily coerced to strings inside of the aforementioned functions, but null is not consumable if singularly passed in. Some examples for context: https://3v4l.org/ENVip I look forward to hearing feedback/concerns. Mick mickmackusa