Skip to content

Commit

Permalink
Merge pull request #2 from ManueldG/array
Browse files Browse the repository at this point in the history
update old file in reference/array/function/
  • Loading branch information
ManueldG authored Feb 12, 2025
2 parents 3ee5600 + 8399420 commit d102fb1
Show file tree
Hide file tree
Showing 14 changed files with 263 additions and 186 deletions.
14 changes: 7 additions & 7 deletions reference/array/functions/array-change-key-case.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: cucinato Status: ready -->
<!-- EN-Revision: 58d11dfe19531e1355980b2892964c07dd8e8068 Maintainer: Manuel dG Status: ready -->
<refentry xml:id="function.array-change-key-case" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_change_key_case</refname>
<refpurpose>Restituisce un array con tutte le chiavi cambiate in maiuscolo o in minuscolo</refpurpose>
<refpurpose>Cambia case a tutte le chiavi dell'array</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_change_key_case</methodname>
<methodparam><type>array</type><parameter>input</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>case</parameter><initializer>CASE_LOWER</initializer></methodparam>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>case</parameter><initializer><constant>CASE_LOWER</constant></initializer></methodparam>
</methodsynopsis>
<para>
Restituisce un array con tutte le chiavi in <parameter>input</parameter> cambiate
in maiuscolo o minuscolo. Gli indici numerati non sono modificati.
Restituisce un array con tutte le chiavi di un <parameter>array</parameter> convertite
in maiuscolo o minuscolo. Gli indici numerici non vengono modificati.
</para>
</refsect1>

Expand All @@ -25,7 +25,7 @@
<variablelist>

<varlistentry>
<term><parameter>input</parameter></term>
<term><parameter>array</parameter></term>
<listitem>
<para>
L'array su cui lavorare
Expand Down
52 changes: 38 additions & 14 deletions reference/array/functions/array-chunk.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 965f8ae1ca8d21ba03e80e76105ee1d84bbbc81d Maintainer: cucinato Status: ready -->
<!-- EN-Revision: 214519fdbdd6bfe2942775d3554fa8f440f85404 Maintainer: Manuel dG Status: ready -->
<refentry xml:id="function.array-chunk" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_chunk</refname>
<refpurpose>Spezza un array in tronconi</refpurpose>
<refpurpose>Divide un array in più subarray</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_chunk</methodname>
<methodparam><type>array</type><parameter>input</parameter></methodparam>
<methodparam><type>int</type><parameter>size</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter><initializer>false</initializer></methodparam>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter><initializer>&false;</initializer></methodparam>
</methodsynopsis>
<para>
Spezza l'array in più array di dimensione <parameter>size</parameter>.
Divide l'array in più array di dimensione <parameter>length</parameter>.
L'ultimo array potrebbe ovviamente avere una dimensione inferiore.
</para>
</refsect1>
Expand All @@ -26,7 +26,7 @@
<variablelist>

<varlistentry>
<term><parameter>input</parameter></term>
<term><parameter>array</parameter></term>
<listitem>
<para>
L'array su cui lavorare
Expand All @@ -35,7 +35,7 @@
</varlistentry>

<varlistentry>
<term><parameter>size</parameter></term>
<term><parameter>length</parameter></term>
<listitem>
<para>
La dimensione di ogni pezzo
Expand All @@ -47,8 +47,8 @@
<term><parameter>preserve_keys</parameter></term>
<listitem>
<para>
Quando è &true; le chiavi sono mantenute.
Il default è &false; che reindicizza le chiavi con valori numerici
Quando è impostato a &true; le chiavi sono mantenute.
Il valore di default è &false; che reindicizza le chiavi con valori numerici
</para>
</listitem>
</varlistentry>
Expand All @@ -61,18 +61,43 @@
&reftitle.returnvalues;
<para>
Restituisce un array multidimensionale indicizzato numericamente, a partire da zero,
con ogni dimensione contenente <parameter>size</parameter> elementi.
con ogni dimensione contenente <parameter>lenght</parameter> elementi.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
Se <parameter>size</parameter> è minore di 1
<constant>E_WARNING</constant> verrà lanciata e sarà restituito &null;.
Se <parameter>length</parameter> è meno di <literal>1</literal>,
un <classname>ValueError</classname> sarà lanciato.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
Se <parameter>length</parameter> è minore di <literal>1</literal>,
un <classname>ValueError</classname> sarà generato;
precedentemente, veniva lanciato un errore di tipo <constant>E_WARNING</constant>
e la funzione restituiva &null;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down Expand Up @@ -146,7 +171,6 @@ Array
</refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
Expand Down
1 change: 1 addition & 0 deletions reference/array/functions/array-combine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Array
<member><function>array_merge</function></member>
<member><function>array_walk</function></member>
<member><function>array_values</function></member>
<member><function>array_map</function></member>
</simplelist>
</para>
</refsect1>
Expand Down
4 changes: 2 additions & 2 deletions reference/array/functions/array-count-values.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</methodsynopsis>
<para>
<function>array_count_values</function> restituisce un array usando
i valori dell'<parameter>array</parameter> (che devono essere &integer; o &string;)
come chiavi e la frequenza degli elementi nell'<parameter>array</parameter> come valori.
i valori dell'<parameter>array</parameter> (che devono essere &integer; o &string;)
come chiavi e la frequenza degli elementi nell'<parameter>array</parameter> come valori.
</para>
</refsect1>

Expand Down
6 changes: 3 additions & 3 deletions reference/array/functions/array-diff-assoc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<term><parameter>array</parameter></term>
<listitem>
<para>
L'array da confrontare
The array to compare from
</para>
</listitem>
</varlistentry>
Expand All @@ -40,7 +40,7 @@
<term><parameter>arrays</parameter></term>
<listitem>
<para>
Gli array con cui confrontare
Arrays to compare against
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -158,7 +158,7 @@ Array
(
[0] => 0
[1] => 1
)
)
]]>
</screen>
</example>
Expand Down
56 changes: 30 additions & 26 deletions reference/array/functions/array-filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,37 +133,39 @@
<programlisting role="php">
<![CDATA[
<?php
function dispari($var)
function odd($var)
{
return($var % 2 == 1);
// returns whether the input integer is odd
return $var & 1;
}
function pari($var)
function even($var)
{
return($var % 2 == 0);
// returns whether the input integer is even
return !($var & 1);
}
$array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
$array2 = array(6, 7, 8, 9, 10, 11, 12);
$array1 = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5];
$array2 = [6, 7, 8, 9, 10, 11, 12];
echo "Dispari :\n";
print_r(array_filter($array1, "dispari");
echo "Pari :\n";
print_r(array_filter($array2, "pari");
echo "Odd :\n";
print_r(array_filter($array1, "odd"));
echo "Even:\n";
print_r(array_filter($array2, "even"));
?>
]]>
</programlisting>
&example.outputs;
<screen role="php">
</programlisting>
&example.outputs;
<screen role="php">
<![CDATA[
Dispari :
Odd :
Array
(
[a] => 1
[c] => 3
[e] => 5
)
Pari:
Even:
Array
(
[0] => 6
Expand All @@ -181,24 +183,26 @@ Array
<![CDATA[
<?php
$entry = array(
0 => 'pippo',
1 => false,
2 => -1,
3 => null,
4 => ''
);
$entry = [
0 => 'foo',
1 => false,
2 => -1,
3 => null,
4 => '',
5 => '0',
6 => 0,
];
print_r(array_filter($entry));
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => pippo
[0] => foo
[2] => -1
)
]]>
Expand Down
3 changes: 1 addition & 2 deletions reference/array/functions/array-key-exists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<!-- CREDITS: cucinato -->
<refentry xml:id="function.array-key-exists" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_key_exists</refname>
<refpurpose>Controlla se l'indice o la chiave specificato esiste nell'array</refpurpose>
<refname>array_key_exists</refname>
<refpurpose>Controlla se l'indice o la chiave specificato esiste nell'array</refpurpose>
</refnamediv>

Expand Down
34 changes: 25 additions & 9 deletions reference/array/functions/array-map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_map</methodname>
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
<methodparam><type>array</type><parameter>array1</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam>
<methodparam><type class="union"><type>callable</type><type>null</type></type><parameter>callback</parameter></methodparam>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam rep="repeat"><type>array</type><parameter>arrays</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_map</function> restituisce un &array; che contiene
Expand Down Expand Up @@ -54,7 +54,7 @@
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>array1</parameter></term>
<term><parameter>array</parameter></term>
<listitem>
<para>
Un array su cui eseguire la funzione <parameter>callback</parameter>.
Expand All @@ -63,7 +63,7 @@
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter></term>
<term><parameter>arrays</parameter></term>
<listitem>
<para>
Array di argomenti supplementari da eseguire nella
Expand Down Expand Up @@ -93,6 +93,23 @@
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&array.changelog.by-ref;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down Expand Up @@ -138,7 +155,7 @@ Array
<programlisting role="php">
<![CDATA[
<?php
$func = function($value) {
$func = function(int $value): int {
return $value * 2;
};
Expand Down Expand Up @@ -172,12 +189,12 @@ Array
<programlisting role="php">
<![CDATA[
<?php
function show_Spanish($n, $m)
function show_Spanish(int $n, string $m): string
{
return "Il numero {$n} si dice {$m} in Spagnolo";
}
function map_Spanish($n, $m)
function map_Spanish(int $n, string $m): array
{
return [$n => $m];
}
Expand Down Expand Up @@ -467,7 +484,6 @@ array(3) {
</para>
</refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
Expand Down
Loading

0 comments on commit d102fb1

Please sign in to comment.