1
0
mirror of https://github.com/php/doc-en.git synced 2026-04-27 01:08:09 +02:00
Commit Graph

710 Commits

Author SHA1 Message Date
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: https://github.com/php/php-src/blob/11b612af6dbe9fdd60edb58d37e441c97bff79e0/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
Tim Starling 54ff7bf8e0 Updates for RFC: Locale-independent case conversion (#1934)
* Add a detailed description of what is meant by ASCII case conversion
  to strtolower() and strtoupper().
* Replace locale-related text on ucfirst(), lcfirst() and ucwords()
  with text about ASCII case conversion.
* Remove entity note.locale-single-byte since it was only used on
  ucwords().
* Add changelog entries to all the functions mentioned in the RFC.

Co-authored-by: George Peter Banyard <girgias@php.net>
2022-11-07 14:17:15 +00: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