Re: [PHP-DEV] array_reduce callback key
This is not the first time that a developer needs access to the input array's keys within the callback of array_reduce(). It is untrue that you "can't access it"; you just need to use an array of keys as the input array. Some frameworks already have the feature of key access built into their methods/functions. https://laravel.com/docs/11.x/collections#method-reduce Examples of passing array_keys to array_reduce (some of which are more than a decade old): https://stackoverflow.com/a/10196070/2943403 https://stackoverflow.com/a/27419768/2943403 https://stackoverflow.com/a/27809675/2943403 https://stackoverflow.com/a/32226816/2943403 https://stackoverflow.com/a/33372066/2943403 https://stackoverflow.com/a/37728665/2943403 https://stackoverflow.com/a/39322532/2943403 https://stackoverflow.com/a/45508817/2943403 https://stackoverflow.com/a/48664250/2943403 https://stackoverflow.com/a/49035053/2943403 https://stackoverflow.com/a/57966850/2943403 https://stackoverflow.com/a/58997848/2943403 https://stackoverflow.com/a/73726419/2943403 https://stackoverflow.com/a/76196482/2943403 mickmackusa On Wed, 17 Jul 2024, 09:15 Bilge, wrote: > Hi Internals, > > I just ran into a case where I needed the array key in an array_reduce() > callback, but I can't access it :( > > So I wrote a PR to fix it: https://github.com/php/php-src/pull/14986 > > What do you think? Does this need an RFC? > > Cheers, > Bilge >
Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4
> > If one can easily use a function incorrectly in a way that is not > *immediately* apparent, then I consider the function to be badly > designed. > Does that philosophy also cover preg_quote()? I've lost count of the number of times that I've seen it used in Stack Overflow answers without a second parameter (including array_map('preg_quote', $array)) and its returned value used in a regex that has foward slashes as delimiters. Additionally, it is an unintuitively named function; it doesn't actually "quote" anything -- it \e\s\c\a\p\e\s characters. This makes life unnecessarily harder for devs who are new to PHP who need to find the regex escaping function. Would it be reasonable to create `preg_escape()` which also (sometimes unnecessrily) includes the (de facto default delimiter) forward slash in its default list of escaped characters so that preg_quote() could eventually be deprecated? As far as I know this would do no harm, will prevent holes in code, and make PHP more intuitive. Mick >
[PHP-DEV] Proposal: Make $offset of substr_replace null by default
substr_replace() has the following signature: substr_replace( array <https://www.php.net/manual/en/language.types.array.php>|string <https://www.php.net/manual/en/language.types.string.php> $string, array <https://www.php.net/manual/en/language.types.array.php>|string <https://www.php.net/manual/en/language.types.string.php> $replace, array <https://www.php.net/manual/en/language.types.array.php>|int <https://www.php.net/manual/en/language.types.integer.php> $offset, array <https://www.php.net/manual/en/language.types.array.php>|int <https://www.php.net/manual/en/language.types.integer.php>|null <https://www.php.net/manual/en/language.types.null.php> $length = null <https://www.php.net/manual/en/reserved.constants.php#constant.null> ): string <https://www.php.net/manual/en/language.types.string.php>|array <https://www.php.net/manual/en/language.types.array.php> Was it deliberate to not allow a null value as the third parameter? If permitted to amend this signature, I think it would be sensible to set null as the default value for $offset and adopt the same logic as the $length parameter. I have recently stumbled upon what I assume is a code smell in multiple SO scripts that use: $prefixed = preg_filter('/^/', 'prefix_', $array); It smells because regardless of the passed in array values' types, there will always be a starting position of each values which are coerced to strings. In other words, the destructive feature of preg_filter() is never utilized. This means that for this task, preg_filter() can be unconditionally replaced with preg_replace(). $prefixed = preg_replace('/^/', 'prefix_', $array); But wait, regex isn't even needed for this task. It can be coded more efficiently as: $prefixed = substr_replace($array, 'prefix_', 0, 0) Next, my mind shifted to suffixing/postfixing. By using $ in the pattern. $prefixed = preg_replace('/$/', 'prefix_', $array); However, there isn't a convenient way to append a string to each value using substr_replace() with the current signature. If the $offset parameter worked like the $length parameter, then the language would provide a native, non-regex tool for appending a static string to all array elements. $suffixed = substr_replace($array, '_suffix'); Finally, I wish to flag the observation that 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
[PHP-DEV] Declaring new elements as references while destructuring within a foreach() head
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 feature? If not a bug should a note/section clarify this behavior? https://www.php.net/manual/en/language.types.array.php My demonstration can be found at this evidently unhelpful question: https://stackoverflow.com/q/77741716/2943403
Re: [PHP-DEV][VOTE][RFC] Add multibyte trim function mb_trim, mb_ltrim and mb_rtrim
> > 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 mb_trim()? Is it true that the .. character range syntax will not be supported at all or is it merely that that syntax will not be allowed when one of the range limits includes a multibyte character? Is a mix of a single byte range plus individual multibyte characters allowed? If .. is attempted, will it be silently interpretted as two literal dots or will some kind of Notice be issued? I want to keep https://stackoverflow.com/a/72865139/2943403 accurate and up to date.
Re: [PHP-DEV] ??= and function calls
I didn't even realize that there was a difference between preincrementation and postincrementation when used in array access. I guess this is because my default preference is preincrementation and also that I probably don't use a lot of incrementation while accessing array data. I held a false 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] Possible RFC: PDOStatement::addBatch
So if I'm not missing something, you want to add this new method to core to accommodate situations where: 1. the dev is too inexperienced to implement a pre-existing library and 2. the incoming 2d payload is not packaged as a csv file (and therefore cannot be directly imported as such) and 3. the application does not benefit from accessing the auto-incremented ids generated by each insert and 4. the performance of the bulk insertions resolves a crippling bottleneck in performance? IMO, the total footprint of your implemented snippet isn't significantly "sleeker/sexier" 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
Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`
As an answerer and curator of many [php][arrays][grouping] tagged questions on Stack Overflow for several years, I'd like to mention that developers' non-SQL grouping needs are much more nuanced than merely defining group qualification and creating subarrays. Often devs will want to sum, count (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] Array spread append
> > > * 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 consistent with `foreach ($arr2 as $v) { $arr1[] = $v; }` (or more succinctly with a bodiless loop: `foreach ($arr2 as $arr1[]);`. In this regard, it appears to destroy $arr2 keys while appending. So for cases with non-numeric keys that choke the spread operator within `array_push()`, then the bodiless loop isn't horrific. What I do find unsettling is that the spread operator in its current implementations always serves to unpack the payload that follows it (on its right side). However, in this new implementation, the three dots are entombed in square braces -- it would be inconsistent with the language. I think it would be more intuitive to implement an array "appending" functionality with "concatenating" syntax. The `.=` syntax already exists, but is forbidden from use on non-strings. If you want to implement this preexisting syntax as an array concatenation operator, then it is a blank slate -- you can decree whatever behaviors you wish for it without blurring what the combined operator does with strings. This opportunity is similar to how `+=` acts as an addition-assignment operator or an array union operator depending on context. I don't think I have an appetite for going down this road, but if so, I could imagine appending with `$all = $arr1 . $arr2 . $arr3;` The reason that I find this unsavory is probably because it becomes harder to intuit a data type by merely scanning code functionality. If the variable names aren't indicative and there is no type hinting, it will be hard to discern string variables from array variables without more context. I suppose my parting thought on this discussion is that the spread operator is just not the best tool for this job -- if this is a job worth doing at all. Mick
Re: [PHP-DEV] Array spread append
Call me sentimental, but are we just trying to choke out the few remaining reasons to keep array_push() in the language? Okay, yeah, sometimes at is a drag that the first parameter has to be declared in advance and is modified by reference (which means you can't enjoy null coalescing or short ternary syntax directly in the first parameter) but... The whole purpose of array_push() is to append one or more elements to an array. Spreading the second parameter makes this task simple/clean. https://3v4l.org/RcKRD I feel like PHP already has an extensive toolbelt for merging array data. I am not yet sold on this new/strange implementation of the spread operator. Mick Harner mickmackusa
Re: [PHP-DEV] RFC idea: array_*(Enum)
On Thursday, February 23, 2023, Robert Landers wrote: > Hello, internals, > > Currently, this is an Error: > > $allowedRoles = [Role::Admin]; > $hasRoles = [Role::User, Role::Admin]; > > if(!empty(array_intersect($allowedRoles, $hasRoles))) doSomething(); > > This is an error because enums cannot be cast to a string (and trying > to make them stringable is not allowed) and many array functions > expect something stringable. To work around this limitation, the above > example must be rewritten like this: > > array_uintersect($allowedRles, $hasRoles, fn($l, $r) => $l === $r ? 0 : > 1)); > > Robert Landers > Software Engineer > Utrecht NL > ...I'd like to add as an aside that: if(!empty(array_intersect($allowedRoles, $hasRoles))) is more simply written as if (array_intersect($allowedRoles, $hasRoles)) -- And for anyone unfamiliar with array_udiff_ and array_uintersect_ functions: 1. The two variables in their callback function signature do not relate by position to the input arrays. This is why it is common to use $a and $b (as is common when calling usort()). In other words, the first input array's data may occur as the first parameter in the callback or the second parameter (like wise with subsequent input arrays). 2. The return value from these functions is expected to be an integer from the result of a three-way comparison -- not the int value of a binary evaluation. Most simply, 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
[PHP-DEV] Remove warning when parsing datetime with + symbol?
Can anyone explain to me why it is desirable/beneficial for the DateTime class to store a warning that trailing characters were ignored while parsing a date/time string with the + symbol in createFromFormat()? Basic example: https://3v4l.org/Sod9o $dt = DateTime::createFromFormat('h:i:A+', '01:31:PM - 03:00:PM'); var_export(DateTime::getLastErrors()); Output: array ( 'warning_count' => 1, 'warnings' => array ( 8 => 'Trailing data', ), 'error_count' => 0, 'errors' => array ( ), ) Docs: https://www.php.net/manual/en/datetimeimmutable.createfromformat.php#:~:text=If%20this%20format,instead I mean, why would I welcome the warning when I explicitly stated that I want to ignore the trailing characters? If there is longer a good reason for the warning, can it be removed from the language? If there is some benefit from having this feedback, then could it be moved to be 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
[PHP-DEV] Character range syntax ".." for character masks
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 >> https://stackoverflow.com/q/72865138/2943403 >> > > Out of curiosity, why do you say that strtr() is "not a good candidate > because character order matters" (although you give a reasonable example)? > Maybe you have some counter-example? > > Regards, > > -- > Guilliam Xavier > I prefer to keep my scope very tight when posting on Stack Overflow. My focus was purely on enabling character range syntax for native functions with character mask parameters. My understanding of character masks in PHP requires single-byte characters and no meaning to character order. When strtr() is fed two strings, they cannot be considered "character masks" because the character orders matter. If extending character range syntax to parameters which are not character masks, I might support the feature for strtr(), but ensuring that the two strings are balanced will be made more difficult with ranged syntax. strtr() will silently condone imbalanced strings. https://3v4l.org/PY15F
[PHP-DEV] Re: Character range syntax ".." for character masks
> > > 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 think there is any benefit in explaining how these functions work. The sole purpose for this change (and the reason that other functions have it already) is to reduce code bloat without needing any extra function calls. If the feature is good enough for the first 7 functions, then it should be good enough for these other 4 functions. Breaking change possibility: if code is silly enough to repeat ANY characters in the mask AND the repeated character is a dot between two other characters, then I don't have much sympathy. Honestly though, we are talking about a super unlikely occurrence. Some demos: https://3v4l.org/2Y0q4 Mick
[PHP-DEV] Re: Character range syntax ".." for character masks
On Saturday, July 9, 2022, Kirill Nesmeyanov wrote: > > Note that the "..." operator is unary, so there is no syntax conflict when > using two floats: > ``` > echo 0...1; // 00.1 > ``` > > However, in the case of the ".." operator, it is assumed to be a binary > operator, so problems with grammar ambiguity may arise: > ``` > echo 0 ..1; // 00.1 > echo 0.. 1; // 01 > ``` > > * Note: The syntax you suggest is widely used in at least Ruby ( > https://ruby-doc.org/core-2.5.1/Range.html ) and CoffeeScript. > * Note: There 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 > >https://stackoverflow.com/q/72865138/2943403 > > > >In a nutshell, not all character masks offer ranges via "double dot" > >syntax. Or should I refer to ".." as the "string spread operator" to avoid > >naming conflict with "..." -- the better known "spread operator" (array > >spread operator)? > > > >Rowan/@IMSoP informed me that the current division between the haves and > >the have-nots appears to be based on the source language from which PHP > >pulled. Essentially, if from C, the double dot does not represent a range. > >https://chat.stackoverflow.com/transcript/11?m=54864842#54864842 > > > >Character ranges are not yet supported for: > >- strcspn() > >- strpbrk() > >- strspn() > > > >Before I fire off an RFC, I would like to know: > > > >1. Are there any reasonable objections to consistently implementing > >character range expressions for all character masks? > >2. Are there any native functions that I did not mention my Stack Overflow > >answer? > >3. Is it true that only single-byte characters can be used in all > >scenarios? If so, must it remain that way? > >4. Is there already an official or widely-used term that I should be using > >for the two-dot operator? > > > >I should also mention that I initially considered requesting that all > >character mask parameters be named $mask (instead of $separators, $token, > >or $characters), but I later resigned to the fact that changing to a name > >that describes the texture of the string would remove the more > >vital/intuitive purpose of the string. I suppose the best that can be done > >to inform developers is to explicitly mention in the documentation when > >character range expressions are implemented and demonstrate their usage in > >an 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 > > > -- > Kirill Nesmeyanov > Thanks for your reply, Kirill, but I am no way trying to introduce a new, general use operator for all encountered strings. I am purely focused on having the operator consistently implemented for all character masks. The language construct `echo` does not have a specified character mask parameter. mickmackusa
[PHP-DEV] Character range syntax ".." for character masks
I've discovered that several native string functions offer a character mask as a parameter. I've laid out my observations at https://stackoverflow.com/q/72865138/2943403 In a nutshell, not all character masks offer ranges via "double dot" syntax. Or should I refer to ".." as the "string spread operator" to avoid naming conflict with "..." -- the better known "spread operator" (array spread operator)? Rowan/@IMSoP informed me that the current division between the haves and the have-nots appears to be based on the source language from which PHP pulled. Essentially, if from C, the double dot does not represent a range. https://chat.stackoverflow.com/transcript/11?m=54864842#54864842 Character ranges are not yet supported for: - strcspn() - strpbrk() - strspn() Before I fire off an RFC, I would like to know: 1. Are there any reasonable objections to consistently implementing character range expressions for all character masks? 2. Are there any native functions that I did not mention my Stack Overflow answer? 3. Is it true that only single-byte characters can be used in all scenarios? If so, must it remain that way? 4. Is there already an official or widely-used term that I should be using for the two-dot operator? I should also mention that I initially considered requesting that all character mask parameters be named $mask (instead of $separators, $token, or $characters), but I later resigned to the fact that changing to a name that describes the texture of the string would remove the more vital/intuitive purpose of the string. I suppose the best that can be done to inform developers is to explicitly mention in the documentation when character range expressions are implemented and demonstrate their usage in an 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
Re: [PHP-DEV] Discussion before submission of array_transpose() RFC
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 comparison would be array_column - > https://wiki.php.net/rfc/array_column One interesting thing that Ben > Ramsey wrote alongside that RFC was a pure PHP implementation with > identical behaviour, available for use as a polyfill: > https://github.com/ramsey/array_column > > Unlike array_column, I don't recall personally needing an > array_transpose function, but am willing to believe that many people do. > > > My first piece of advice would be to start with a definition of what you > mean by "transpose" in this context, with an example of input and output > in the basic case, and then a few scenarios where it's useful. > > Having that clear would then help understand the details you go into, > each of which could be accompanied by its own example. For instance: > > > > Let's create an intuitive transposing function for data sets with a > > minimum depth of 2 levels. > > > I can't picture what "transpose" means for something with more than 2 > levels. > > > > As a matter of flexibility, there should be no requirement that the > > lone parameter be a matrix or dense data structure. > > > I have no idea what this means. > > > > It should also preserve keys to give it a clear advantage over > > pre-existing functional techniques. > > > Preserve what keys? > > > > // [['single' => 'row']] becomes ['single' => 'row'] but should be > > ['single' => ['row']] > > > Should it? Why? > > > My second piece of advice is to remember that flexibility, ease of use, > and efficiency, are three corners of a triangle, and you can't optimise > for all three. array_column does a reasonable job of covering multiple > use cases, but there have been several unsuccessful requests over the > years to enhance it or create variations for other use cases, so you're > never going to make everyone happy. > > > > Should the function unconditionally return an array of arrays? > > Should it preserve the initial data types of the first and second level? > > Should data type preservation be excluded to increase the chances of > > its implementation? > > [...] > > 1. Unconditionally cast output as array of arrays. > > [...] > > 2. Preserve original data types of level one and level two. > > https://3v4l.org/RRKlr > > > > (If input is two dimensional, then the first occurring data type in > > the second level will dictate the result's first level data type.) > > [...] > > If only initially implemented to return an array of arrays, then > > expanding the result data types in the future may be of interest. > > > Without really understanding what you're saying, my suspicion is that > these paragraphs are trying too hard to make a Swiss-army knife rather > than a sharp blade. > > > > List of Stack Overflow pages which seek to implement transposition > > > Would all of these requirements be satisfied by the same implementation, > without needing a complex set of options? What can we learn from the > links about what features are likely to be most useful to people? > > > I look forward to seeing a draft RFC, which can take the time to explain > the features you think are needed. > > > Regards, > > -- > Rowan Tommins > [IMSoP] > Thanks for the feedback, Rowan. Here are some answers and thoughts... The basic premise of transposition is to replace the first level keys with the second level keys. This can be visualized as converting columns of data into rows of data. With: A B C D E F G H I the expected result is: A D G B E H C F I When dealing with an indexed array of indexed arrays with more than one row, `array_map(null, ...$array)` is a beautiful, concise technique. However, an array with a single row returns an unexpected structure, and associative arrays and objects cause trouble. Using nested foreach loops is reliable, but is less elegant, requires multiple temporary variables, certainly more verbose, and must be wrapped in a custom function for functional-style coding. Like array_column()'s ability to respect object data, I felt it might be beneficial to allow/respect objects with this function proposal. I've made a judgment call to swap the data types of the first level with the second level, but perhaps data types should be honored, yet not swappe
[PHP-DEV] Discussion before submission of array_transpose() RFC
mensional array in php? -- 50 views 2016 PHP array, move keys and values to new array, but mix it up -- 50 views 2016 How to transpose array elements? -- 900 views 2016 Hierarchical Array Conversion to Flat Array -- 300 views 2016 merge and reorder 3 arrays -- 50 views 2016 Insert database rows from columns of data from associative array of indexed arrays -- 50 views 2017 Transpose rows and columns in a 2D array -- 5K views 2017 php reformat array representation from html form array -- 50 views 2017 How to insert arrays into a main array in PHP to make it 2d array? -- 50 views 2017 How can I combine array's items? -- 250 views 2017 Restructure multidimensional array of column data into multidimensional array of row data -- 1K views 2017 Transpose associative array of associative arrays to create associative array of indexed arrays -- 4K views 2017 Merging PHP array to multidimensional array from another array -- 50 views 2018 Combine items of two array and create new array using php -- 50 views 2018 How to collect 3 arrays in 1 array using PHP? -- 50 views 2018 How do I use array_map recursively in PHP? -- 1K views 2018 Laravel loop through set of input arrays -- 150 views 2018 Foreach to combine to array -- 50 views 2019 php extract associate arrays -- 50 views 2019 How to combine and transpose 2 PHP arrays -- 50 views 2019 How to merge two arrays into one without iteration -- 100 views 2019 How to create an associative array from two arrays? -- 3K views 2019 how to get each column of values as array directly, and without using pluck laravel? -- 650 views 2019 Combine (merge) 2 arrays by keys and change keys name in the result array -- 800 views 2019 Array_map and array_combine for more than two arrays -- 500 views 2019 Merge values from different arrays to one with the same key -- 100 views 2019 Native PHP function that pairs elements from arbitrary number of input arrays -- 50 views 2019 Transpose multidimensional array and join values with commas -- 50 views 2019 How to create 3 arrays from 1 multidimensional array with 2 arrays inside -- 50 views 2019 How to store 3 key by index per row PHP -- 50 views 2019 How to change associative array value in php -- 400 views 2019 How to put array inside array in PHP? -- 50 views 2019 How to Loop through multi dimensional array of $_FILES array -- 200 views 2019 How to change associative array value in php -- 400 views 2019 PHP multi-dimensional array, merge duplicate keys into new arrays -- 50 views 2020 Transpose of column to row in php -- 50 views 2020 combine and merge array in laravel -- 100 views 2021 how to import a transposed excel in Laravel using laravel-excel -- 450 views 2021 Transpose imported Excel with Matrix table to Laravel -- 50 views 2021 Group multi array by key and value PHP -- 50 views 2021 Create a multidimensional array based on number of values -- 50 views 2022 Rotate a Collection in laravel -- 50 views 2022 Zip multiple arrays in PHP based on their identical keys and not their indices or their positions in array -- 50 views 2022 Convert nested associative array to single array in php -- 50 views Stack Overflow transposition pages not in PHP: What is the fastest way to transpose a 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 some of that. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php