686 Commits

Author SHA1 Message Date
Jim Winstead
5cc10e8d90 Simplify array_replace description and add nested array example (#3809)
Based on discussion at PR #1470
2024-10-01 11:52:15 -07:00
Tim MacDonald
8859c8b96c Standardise casting spacing (#2717) 2024-09-11 14:29:15 +01:00
Markus Staab
647d5c50e3 fix typo in range() exception case description (GH-3730) 2024-09-09 15:34:19 +02:00
Mikhail Alferov
33968dfebb array-map.xml: add an explanation of the 'zip operation' term (GH-3720)
Why not add a few words about what a 'zip operation' is? Yes, the `array_map` page contains a sample code, but it does not contain a formal explanation, as far as all other doc pages. I suppose this information will be useful :-)

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-09-07 09:52:00 +02:00
Mikhail Alferov
d58ee8eaaa Add a link to the explanation of the term 'symbol table' + slightly adjust the code of the examples (#3666)
* globals.xml: add a link to the explanation of the term "symbol table"

+ amend the code examples

* extract.xml: add a link to the explanation of the term "symbol table"

+ amend the code examples

* compact.xml: add a link to the explanation of the term "symbol table"

+ amend the code examples

* references.xml: add a link to the explanation of the term "symbol table"

+ amend the code examples

* Nits

---------

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-08-25 23:22:41 +01:00
Christoph M. Becker
4acad9b77f Fix GH-3307: ksort() behavior changed since PHP 8.2 2024-08-07 22:36:46 +02:00
Christoph M. Becker
cec5275f23 Fix #3634: Mismatch between array_walk(_recursive) return type in stub and documentation 2024-08-01 17:53:34 +02:00
Mikhail Alferov
1de7b5b65f array-filter.xml: leave one: delete or unset as identical (#3593) 2024-07-26 03:48:17 +01:00
Takuya Aramaki
4a1dedc24b array_rand() may throw ValueError since 8.0 (#3230)
array_rand() throws ValueError if empty array is given or num is out of range


Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-03-05 22:33:33 +00:00
Mikhail Alferov
768876982f Fix wrong parameter name in reference to array_keys() (#3180)
The second parameter of the `array_keys()` function is `filter_value` not `search_value`
2024-02-13 17:03:45 +00:00
Niels Dossche
2ed209827b Update array_pad docs for 8.3 (#3174) 2024-02-13 16:53:23 +00:00
Gina Peter Banyard
56509d07ae Fix GH-3003 (array_udiff(): Add precision to the comparison function) (#3070) 2024-01-27 19:23:19 +00:00
Josh S
89fe795cc8 Update array_key_exists() key parameter type as of PHP 8.0.0 (#3135) 2024-01-25 13:27:45 +00:00
Sergey Panteleev
443d81b33e [PHP 8.3] Update functions (#3106)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-01-16 16:36:49 +03:00
George Peter Banyard
62421b98a9 range: Update for PHP 8.3 (#2801)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2023-10-16 17:36:01 +02:00
dreeh
58d11dfe19 Remove ZPP failure mention in array_change_key_case() (#2849)
Co-authored-by: Denny Reeh <denny.reeh@check24.de>
2023-10-10 13:13:11 +01:00
Hideki Kinjyo
e311803cd2 compact() issues an E_WARNING as of PHP 8.0 (#2776)
PHP 8.0 converted a number of notice to warnings via the "Reclassifying engine warnings" RFC:
https://wiki.php.net/rfc/engine_warnings
2023-09-19 18:42:22 +01:00
Alexandre Daubois
6b64170daa Fix GH-2631: Clarify array_diff_(u)assoc examples (#2650) 2023-08-07 15:27:29 +01:00
Alexandre Daubois
55b7203be4 Fix GH-2631: Fix examples for array diff functions (#2634) 2023-08-01 15:14:36 +01:00
LionelMallet
6b56e6f444 Improve the refpurpose of array_count_values() (#2558) 2023-07-04 21:00:40 +01:00
Dominik Ritter
71e3c74047 docs: add a reference to array_map from array_combine (#2534) 2023-06-21 21:51:47 +01:00
Máté Kocsis
f781803449 Narrow bool return types to true when possible (#2458) 2023-05-07 22:32:58 +02:00
KOSEKI Kengo
2226ad08fd Restore type juggling caution for return value of user comparison callback (#2368)
Create an XML sort.callback.description entity which contains the description of this parameter with the caution

Co-authored-by: George Peter Banyard <girgias@php.net>
2023-03-23 13:08:38 +00:00
Chuong
2ca0903429 fix: true return type for return true always function (#2154)
Various functions and method have had their return type changed to true.

Fix this and add changelog entries.

Co-authored-by: George Peter Banyard <girgias@php.net>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2023-02-20 16:16:37 +00:00
Daniel Siepmann
3ba15fd3df Don't mention sorting but comparison (#2301)
The array_unique function doesn't sort, but compares.
It uses the same constants but terms are mixed up.
The text uses "sorting" while each constant uses "compare".

This is now streamlined in order to reduce friction while reading.
2023-02-17 20:15:38 +01:00
niemeier23
c6534cb59e Plurality grammar correction (#2275) 2023-02-08 18:09:59 +00:00
Christoph M. Becker
6d29533483 Fix GH-2156: stdClass is spelled in different cases: StdClass / stdclass
Closes GH-2157.
2023-01-10 11:56:39 +01:00
Christoph M. Becker
fea4357a0c Revert "Fixed and simplified array_replace description"
This reverts commit bb36df3ed4, which has
been committed inadvertently.
2022-12-26 15:43:51 +01:00
Dennis Weiershäuser
bb36df3ed4 Fixed and simplified array_replace description 2022-12-26 14:08:03 +01:00
Tiffany
caf779183e Add an example with two associative arrays to array_unshift page (#1954)
* Add an example showing how two associative arrays are combined

* Modernize array syntax in first example, use var_dump over print_r, revise wording, add types of fruits and vegetables into second example

* Add `array_merge()` to the "See Also" section
2022-12-17 14:26:10 -06:00
Juliette
5414f72979 array_keys(): fix incorrect parameter name
... which would break function calls using named parameters. Demo: https://3v4l.org/7BNbJ

Ref: 11b612af6d/ext/standard/basic_functions.stub.php (L1691)

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>

Closes GH-2044.
2022-12-08 11:26:30 +01:00
Tim Düsterhus
fc1e94a9c2 random: Improve the non-CSPRNG warning (#2009)
* Strengthen the wording in `&caution.cryptographically-insecure;`

It’s not: “should not”, it’s “must not”.

* random: Unify use of `&caution.cryptographically-insecure;`

- The warning goes last.
- It is actually applied to all functions.

* random: Completely rewrite the `&caution.cryptographically-insecure;` warning

* random: Revert indentation changes to lcg-value.xml
2022-11-17 11:53:00 +01:00
Tim Düsterhus
52c495140b random: Clean up cross-references for randomness related functions (#2008)
* random: Reference the corresponding Randomizer methods in random_(bytes|int)

* random: Cross-reference the Randomizer in `str_shuffle()`

* random: Cross-reference the Randomizer in `shuffle()`

* random: Cross-reference the Randomizer in `array_rand()`

* random: Cross-reference `random_bytes()` in `uniqid()`

* random: Do not cross-reference `uniqid()` in `openssl_random_pseudo_bytes()`

uniqid() really is no good alternative to *anything*. In the vast majority of
cases it is better replaced by `bin2hex(random_bytes(…))`.

* random: Replace the `mt_rand()` cross-reference in `openssl_random_pseudo_bytes()` with `random_int()`

random_int() is a CSPRNG like openssl_random_pseudo_bytes(), mt_rand() is not.
2022-11-15 11:19:28 +01:00
Christoph M. Becker
9009f8104b array_count_values() requires all array values to be int|string
Cf. <https://github.com/php/doc-de/issues/107>.
2022-10-13 18:28:48 +02:00
Jorg Adam Sowa
2c0d7af2fd Remove irrelevant info about warning
Passing anything other than an array, is undefined behavior (at least under PHP 7).

Closes GH-1879.
2022-10-11 12:22:12 +02:00
Tiffany Taylor
2762980ae4 Fix spacing in an example 2022-10-03 18:00:29 -06:00
Larry Garfield
8cd7c0d8c5 Add note about how bad weak mode is for in_array
Closes GH-1768.
2022-08-25 13:41:43 +02:00
duvall
ce882c196d Document changed array_fill() behavior as of PHP 8.0.0
The result in php8 is different from the result in php7 for
negative keys.

Closes GH-1767.
2022-08-25 12:41:12 +02:00
Christoph M. Becker
d93972fb2d Fix GH-1751: array_pop() throws TypeError in PHP8
There is no need to describe the behavior on passing an unsupported
type at all, since that is already documented generally for internal
functions.
2022-08-16 14:14:20 +02:00
Quentin Dreyer
529b4f9878 Fix php8 array_udiff_uassoc compatibility
Closes GH-1721.
2022-07-27 15:23:49 +02:00
Quentin Dreyer
7bbd1aac4d Fix php8 array_udiff_assoc compatibility
Closes GH-1720.
2022-07-27 15:21:44 +02:00
Sergey Panteleev
9d29b38286 Fix foreach links (#1706) 2022-07-20 12:46:53 +03:00
Christoph M. Becker
eaaf3a0b45 Fix GH-1632: array_fill() is missing boundary for $count 2022-07-14 13:56:45 +02:00
Felipe Martins
d45ff7a3e7 Add an array_walk() example using an anonymous function
Closes GH-1654.
2022-07-01 11:03:25 +02:00
othercorey
a51ec67350 Fix return type explanation for array_recursive
Closes GH-1649.
2022-06-27 23:17:38 +02:00
othercorey
c84024092a Add changelog for array_diff and array_intersect functions (#1650) 2022-06-27 16:12:32 -05:00
Pierrick Charron
08e0e7dd68 Replace each() with foreach in usort and simplexmlelement/xpath 2022-05-26 13:16:41 -04:00
Christoph M. Becker
214519fdbd Fix GH-1586: Changed error behavior in array_chunk in php 8 2022-05-18 14:55:27 +02:00
Sergey Panteleev
764e22fefc Update array_combine return values section (#1513)
Fix #1512
2022-04-12 13:24:42 +03:00
Yoshinari Takaoka
e3ac07c850 moved too long title to <para></para> contents. 2022-04-09 17:49:08 +09:00