Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array sync with EN #1975

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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