1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 07:42:10 +01:00
Commit Graph

657 Commits

Author SHA1 Message Date
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
Larry Garfield
706c7ac6ea Usort updates based on comments (#1492)
* Use spaceship where appropriate.

* Add example of multi-axes sorting with spaceship.

* Don't acknowledge the existence of PHP < 7
Co-authored-by: George Peter Banyard <girgias@php.net>

* Minor updates
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Co-authored-by: George Peter Banyard <girgias@php.net>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2022-04-08 11:24:38 -06:00
沈唁
431616624d Fix array_combine throws ValueError since PHP 8 (#850) 2022-03-30 16:33:13 -05:00
George Peter Banyard
41f8ef5540 Fix inconsistent section orders 2022-03-13 22:37:42 +00:00
Christoph M. Becker
e8c83816e0 array_map() maps values, not indexes
Cf. <https://news-web.php.net/php.doc/969388082>.
2022-03-02 13:22:41 +01:00
Ariel Allon
8b00eb9807 disambiguate semantics of search_value
The definition of `search_value` in "Parameters" is a bit ambiguous. "these values" _could_ be interpreted to mean that if an array is passed as the `$search_value`, keys of elements of `$search_value` that match _any_ of those `$array` elements will be returned.
Note, the "Description" section does not have this ambiguity as it states "that value" instead of "those values".

Closes GH-1429.
2022-02-25 12:52:44 +01:00
aleksandr-shevchenko
9b89d5c26b Improve description of step argument to range()
Closes GH-1416
2022-02-20 17:17:21 +00:00
Christoph M. Becker
14b55b8b4b Don't use old style constructor in example
Closes GH-1406.
2022-02-15 13:19:43 +01:00
Christoph M. Becker
eba8e74c75 The array_walk() $callback may require more than 2 parameters
Cf. <https://3v4l.org/jdjEG>.
2021-12-31 19:52:36 +01:00
Christoph M. Becker
31cacb6f26 Fix #80699: array_map no longer passes by reference 2021-12-31 19:21:39 +01:00
Christoph M. Becker
8a7836bf88 Fix GH-1178: array_flip allegedly can return null 2021-12-08 11:29:58 +01:00
Sergey Panteleev
0a192fcd9c [PHP 8.1] Changelog entry for standard functions (#1123)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes #1034
2021-12-02 15:26:58 +03:00
vlakoff
76c26359d5 On page for key(), add link to array_key_first()
Closes GH-1129.
2021-11-23 00:32:07 +01:00
Salomon88
6a6f43d1c4 Documentation of index reset effect of some array functions - issue #876 (#1077)
Co-authored-by: Alexey Kryuchkov <alexey.kryuchkov@jetbrains.com>

Closes GH-1077.
2021-11-09 13:01:19 +01:00
Kamil Tekiela
3ef3e56c80 Rewrite count() page (#948)
* Rewrite count() page

* Change methodname to interface name and fix example output

* Add example with Countable object

* Delete redundant code comments
2021-10-11 13:31:31 +01:00
Sergey Panteleev
5ecd5e8e50 [PHP 8.1] Add array_is_list description (#986)
Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2021-10-02 19:52:56 +03:00
Martin Samesch
94af09dfef typo 2021-09-20 11:23:20 +02:00
George Peter Banyard
8b54a4bf8c Array Natural sort functions always return true 2021-09-05 14:48:08 +01:00
George Peter Banyard
d1df62fe77 Update array sorting docs
These always return true, even in PHP 7
Clarify sorting is unstable prior to PHP 8.0
Normalize the docs between the functions

Closes GH-686
2021-08-19 15:46:00 +01:00
Máté Kocsis
60809ebcf7 Generate ext/spl methodsynopses based on stubs (#624) 2021-08-11 23:44:41 +02:00
Kamil Tekiela
43ac336818 Remove XSS and broken example from list() page (#797) 2021-08-05 21:06:40 +01:00
Larry Garfield
d042804100 Fold in comments to array_map()
Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>

Closes GH-828.
2021-07-30 18:18:35 +02:00
Larry Garfield
b8aafb570c Add additional reference to array_filter. 2021-07-29 11:32:30 -04:00
Karsten Lehmann
d42b32e96b Fix parameter names for array functions (#616)
* Fix parameter names in array_walk docs

* Fix parameter names in documentation for array_walk_recursive
2021-07-07 21:53:13 +01:00
zors1
f2af34e50c Replace a comma with a period in sort.xml
Closes GH-746.
2021-06-30 14:54:14 +02:00
jhdxr
e559d0d44d update refpurpose for sort functions as well 2021-06-12 02:37:45 +08:00
蝦米
9ec0244d48 Clarify the order of sort functions in their description
Closes GH-681.
2021-06-11 18:51:25 +02:00
George Peter Banyard
cbac1ecf71 Fix lone section order issues in various extensions
Part of #658
2021-06-06 18:03:03 +01:00
Sergey Panteleev
8cdc6621f9 Remove PHP 5, 7 references (#563)
- array functions
- datetime functions
- mbstring functions
- strings functions
- var functions
- xml functions
- json functions
2021-05-16 22:07:40 +03:00
thinkverse
8a7c2e0368 Fix changelog being at the wrong section 2021-04-29 19:28:16 +01:00