Skip to content

Commit

Permalink
array sync with EN (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen authored Dec 26, 2024
1 parent 9f0d0c6 commit 5dcc337
Showing 1 changed file with 41 additions and 12 deletions.
53 changes: 41 additions & 12 deletions reference/array/functions/array-column.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 8cdc6621f9826d04abc3e50438c010804d7e8683 Maintainer: yannick Status: ready -->
<!-- EN-Revision: 8bf3587d8f70239a65d9aa44d42ced8a696a3e86 Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<!-- CREDITS: DavidA. -->
<refentry xml:id="function.array-column" xmlns="http://docbook.org/ns/docbook">
Expand Down Expand Up @@ -109,32 +109,34 @@
<programlisting role="php">
<![CDATA[
<?php
// Tableau représentant un jeu d'enregistrements issu d'une base de données
$records = array(
array(
$records = [
[
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe',
),
array(
],
[
'id' => 3245,
'first_name' => 'Sally',
'last_name' => 'Smith',
),
array(
],
[
'id' => 5342,
'first_name' => 'Jane',
'last_name' => 'Jones',
),
array(
],
[
'id' => 5623,
'first_name' => 'Peter',
'last_name' => 'Doe',
)
);
]
];
$first_names = array_column($records, 'first_name');
print_r($first_names);
?>
]]>
</programlisting>
Expand All @@ -160,9 +162,34 @@ Array
<programlisting role="php">
<![CDATA[
<?php
// En utilisant le tableau de l'exemple #1
$records = [
[
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe',
],
[
'id' => 3245,
'first_name' => 'Sally',
'last_name' => 'Smith',
],
[
'id' => 5342,
'first_name' => 'Jane',
'last_name' => 'Jones',
],
[
'id' => 5623,
'first_name' => 'Peter',
'last_name' => 'Doe',
]
];
$last_names = array_column($records, 'last_name', 'id');
print_r($last_names);
?>
]]>
</programlisting>
Expand Down Expand Up @@ -207,6 +234,7 @@ $users = [
];
print_r(array_column($users, 'username'));
?>
]]>
</programlisting>
Expand All @@ -227,7 +255,8 @@ Array
<example>
<title>
Récupère la colonne nom depuis la propriété privée "name" d'un
objet en utilisant la méthode magique <function>__get</function>.
objet en utilisant les méthodes magiques <function>__isset</function> et
<function>__get</function>
</title>
<programlisting role="php">
<![CDATA[
Expand Down

0 comments on commit 5dcc337

Please sign in to comment.