# Two new functions array_first() and array_last()

- Thread: https://externals.io/message/121313
- Original archive: https://news-web.php.net/php.internals/121313
- Started by David Grudl on 2023-10-14T18:00:42+00:00
- Messages: 46
- RFC: array_first() and array_last() (Implemented (PHP 8.5)) — https://externals.io/rfc/array_first_last.md
- RFC: array_key_first(), array_key_last() (Implemented (PHP 7.3)) — https://externals.io/rfc/array_key_first_last.md
- Page 1 of 2: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/121313.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #121313 — David Grudl — 2023-10-14T18:00:42+00:00

URL: https://externals.io/message/121313#121313

PHP lacks two very basic functions for working with arrays:

- `array_first()` returning the first element of an array (or null)
- `array_last()` returning the last element of the array (or null)

While PHP has functions that return the first and last keys,
 `array_key_first()` and `array_key_last()`, it does not have more useful
functions for values.

a) What about `reset()` and `end()`?
Programmers "abuse" the `reset()` and `end()` functions for this purpose.
The problem is that these functions are used to move the internal
pointer in the array. Which is why they have a name that is
inappropriate when used in the sense of "return me the first element".

Much worse, they shouldn't to be used to get first/last value, because
they have a side effect (i.e. moving the pointer).

Further, in the absence of an element, they return the obsolete false
and not the currently expected null, which can be combined with the ??
operator. In this they differ from the similar functions
 `array_key_first()` and `array_key_last()`.

b) What about $array[array_key_first($array)]?

For such basic functions as returning the first and last item in an
array, there should be a function in the basic package, not a
workaround. Moreover, this requires having the array in a local
variable, since $this->getFoo()[array_key_first($this->getFoo())]
would be very inefficient and possibly incorrect.

c) Two such functions were proposed and rejected during the
array_key_first/last RFC
(https://wiki.php.net/rfc/array_key_first_last)

Yes, that was in 2018. At that time, functions like `str_contains()` or
 `str_starts_with()` wouldn't have even come into existence, just because
there was an obscure way to do it without them. I believe we've moved
on since then. Today we know how useful it is to use simple,
easy-to-understand methods, both for programmers who write and read
the code.

DG

---

## #121314 — Nikita Popov — 2023-10-14T20:29:28+00:00

URL: https://externals.io/message/121313#121314 · In reply to: #121313

> PHP lacks two very basic functions for working with arrays:
> 
> - `array_first()` returning the first element of an array (or null)
> - `array_last()` returning the last element of the array (or null)
> 
> While PHP has functions that return the first and last keys,
> `array_key_first()` and `array_key_last()`, it does not have more useful
> functions for values.
> 
> a) What about `reset()` and `end()`?
> Programmers "abuse" the `reset()` and `end()` functions for this purpose.
> The problem is that these functions are used to move the internal
> pointer in the array. Which is why they have a name that is
> inappropriate when used in the sense of "return me the first element".
> 
> Much worse, they shouldn't to be used to get first/last value, because
> they have a side effect (i.e. moving the pointer).
> 
> Further, in the absence of an element, they return the obsolete false
> and not the currently expected null, which can be combined with the ??
> operator. In this they differ from the similar functions
> `array_key_first()` and `array_key_last()`.
> 
> b) What about $array[array_key_first($array)]?
> 
> For such basic functions as returning the first and last item in an
> array, there should be a function in the basic package, not a
> workaround. Moreover, this requires having the array in a local
> variable, since $this->getFoo()[array_key_first($this->getFoo())]
> would be very inefficient and possibly incorrect.
> 
> c) Two such functions were proposed and rejected during the
> array_key_first/last RFC
> (https://wiki.php.net/rfc/array_key_first_last)
> 
> Yes, that was in 2018. At that time, functions like `str_contains()` or
> `str_starts_with()` wouldn't have even come into existence, just because
> there was an obscure way to do it without them. I believe we've moved
> on since then. Today we know how useful it is to use simple,
> easy-to-understand methods, both for programmers who write and read
> the code.
> 
> DG

I'm in favor of adding these.

To add to what you already said, because reset/end modify the array, there's a good chance that calling these functions will copy the whole array due to a modification you are not actually interested in.

So basically you have the choice between calling `end()`, which is the wrong thing to do semantically and may be slow, or using $array[array_key_last($array)], which is rather convoluted, and incorrect if the array is potentially empty.

Regards,
Nikita

---

## #121316 — Ben Ramsey — 2023-10-14T23:11:05+00:00

URL: https://externals.io/message/121313#121316 · In reply to: #121314

> 
> 
> ﻿On Sat, Oct 14, 2023, at 20:00, David Grudl wrote:
> > […]
> 
> I'm in favor of adding these.
> 
> To add to what you already said, because reset/end modify the array, there's a good chance that calling these functions will copy the whole array due to a modification you are not actually interested in.
> 
> So basically you have the choice between calling `end()`, which is the wrong thing to do semantically and may be slow, or using $array[array_key_last($array)], which is rather convoluted, and incorrect if the array is potentially empty.
> 
> Regards,
> Nikita

I’m in favor of these functions, for all the same aforementioned reasons.

Cheers,
Ben

---

## #121318 — Saki Takamachi — 2023-10-15T02:42:32+00:00

URL: https://externals.io/message/121313#121318 · In reply to: #121313

Hi, David

Many times I've seen `reset()` used to meet this requirement.

I support this, not only from a side effect standpoint, but also from a readability standpoint. I would also like to add the opinion that it is better because it is simpler than the function name in the original RFC that is being referenced.

Best regards.

Saki

---

## #121319 — Ayesh Karunaratne — 2023-10-15T03:19:57+00:00

URL: https://externals.io/message/121313#121319 · In reply to: #121313

>
> PHP lacks two very basic functions for working with arrays:
>
> - `array_first()` returning the first element of an array (or null)
> - `array_last()` returning the last element of the array (or null)
>
> While PHP has functions that return the first and last keys,
> `array_key_first()` and `array_key_last()`, it does not have more useful
> functions for values.
>
> a) What about `reset()` and `end()`?
> Programmers "abuse" the `reset()` and `end()` functions for this purpose.
> The problem is that these functions are used to move the internal
> pointer in the array. Which is why they have a name that is
> inappropriate when used in the sense of "return me the first element".
>
> Much worse, they shouldn't to be used to get first/last value, because
> they have a side effect (i.e. moving the pointer).
>
> Further, in the absence of an element, they return the obsolete false
> and not the currently expected null, which can be combined with the ??
> operator. In this they differ from the similar functions
> `array_key_first()` and `array_key_last()`.
>
> b) What about $array[array_key_first($array)]?
>
> For such basic functions as returning the first and last item in an
> array, there should be a function in the basic package, not a
> workaround. Moreover, this requires having the array in a local
> variable, since $this->getFoo()[array_key_first($this->getFoo())]
> would be very inefficient and possibly incorrect.
>
> c) Two such functions were proposed and rejected during the
> array_key_first/last RFC
> (https://wiki.php.net/rfc/array_key_first_last)
>
> Yes, that was in 2018. At that time, functions like `str_contains()` or
> `str_starts_with()` wouldn't have even come into existence, just because
> there was an obscure way to do it without them. I believe we've moved
> on since then. Today we know how useful it is to use simple,
> easy-to-understand methods, both for programmers who write and read
> the code.
>
> DG
>

I would love to have these functions in PHP as well.

With the bikeshed risk, perhaps it makes more sense to have the
functions named `array_value_first` and `array_value_last`, because we
already have `array_key_first` and `array_key_last` functions?

---

## #121320 — Saki Takamachi — 2023-10-15T03:48:57+00:00

URL: https://externals.io/message/121313#121320 · In reply to: #121318

I came up with the idea of ​​using a signature like `array_filter()`, and when a callback is passed, "return the first/last element that matches the condition" and "return null if there is no match."

The downside to this idea is the loss of simplicity. So I'll leave it up to you whether you want to go with this idea or not. I have no intention of forcing this.

Best regards.

Saki

---

## #121322 — Paul Dragoonis — 2023-10-15T11:59:51+00:00

URL: https://externals.io/message/121313#121322 · In reply to: #121320

> I came up with the idea of ​​using a signature like `array_filter()`, and
> when a callback is passed, "return the first/last element that matches the
> condition" and "return null if there is no match."
>
> The downside to this idea is the loss of simplicity. So I'll leave it up
> to you whether you want to go with this idea or not. I have no intention of
> forcing this.
>
> Best regards.
>

I'm in favor of these functions.

Right now I am doing:

$firstItem = current($array)
$secondItem = next($array)

Which is simple and works, but really it's just by design that the code
hasn't shifted the array pointer yet and I can cheat with `current()`

If the pointer was shifted then I'd have to do `reset()`, which isn't good.

 `array_first()` for the win

Many thanks,
Paul




> Saki
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php

---

## #121324 — Pierre — 2023-10-15T12:40:11+00:00

URL: https://externals.io/message/121313#121324 · In reply to: #121316

Le 15/10/2023 à 01:11, Ben Ramsey a écrit :
> > […]
> I’m in favor of these functions, for all the same aforementioned reasons.

Yes please !

 `array_first()` and `array_last()` are definitely needed. I wrote `foreach 
($foo as $value) break;` too many times in my life. `array_key_first()` 
and `array_key_last()` I wouldn't use it much, but they'd probably  find 
their use cases as well.

The first two probably only make sense for a numerically indexed array, 
so I guess that `array_is_list()` (whatever the name is, I don't want to 
bikeshed about naming) would be a good addition as well, that, in my 
opinion, would be pertinent to add at the same time.

Regards,

Pierre

---

## #121325 — Larry Garfield — 2023-10-15T16:09:58+00:00

URL: https://externals.io/message/121313#121325 · In reply to: #121324

> The first two probably only make sense for a numerically indexed array, 
> so I guess that `array_is_list()` (whatever the name is, I don't want to 
> bikeshed about naming) would be a good addition as well, that, in my 
> opinion, would be pertinent to add at the same time.

That has already been done: https://www.php.net/array_is_list

--Larry Garfield

---

## #121326 — Saki Takamachi — 2023-10-15T16:21:08+00:00

URL: https://externals.io/message/121313#121326 · In reply to: #121324

Hi Pierre

> The first two probably only make sense for a numerically indexed array

I do not think so. If these are something like "reset/end without side effects", then they should work fine even not numeric indexed array.

Regards.

Saki

---

## #121332 — Pierre — 2023-10-16T09:12:29+00:00

URL: https://externals.io/message/121313#121332 · In reply to: #121325

Le 15/10/2023 à 18:09, Larry Garfield a écrit :
> That has already been done:https://www.php.net/array_is_list
>
> --Larry Garfield

Oh, I forgot it was accepted and merged, thanks for pointing at it.

Cheers,

Pierre

---

## #121341 — Levi Morrison via internals — 2023-10-17T09:10:18+00:00

URL: https://externals.io/message/121313#121341 · In reply to: #121313

> c) Two such functions were proposed and rejected during the
> array_key_first/last RFC
> (https://wiki.php.net/rfc/array_key_first_last)
>
> Yes, that was in 2018. At that time, functions like `str_contains()` or
> `str_starts_with()` wouldn't have even come into existence, just because
> there was an obscure way to do it without them. I believe we've moved
> on since then. Today we know how useful it is to use simple,
> easy-to-understand methods, both for programmers who write and read
> the code.

It's true that sentiment may have shifted in this time. However, a
common argument at that time still stands: `null` is not a good
sentintenal for failure because the value inside the array very well
could have been null. This is not true for the keys. For me
personally, I think I would still vote no. I'm not entirely sure about
that, but that's how I would lean right now.

As it stands, you'd have to write code along the lines of:

```php
$key = \array_key_first($array);
if ($key === null) {
    // handle the failure
} else {
    // success
    $value = $array[$key];
}
```

Yes, it would be slightly nicer if we could do:

```php
$value = \array_first($array);
if ($value === null) {
    // handle the failure
} else {
    // success
}
```

But I fear in practice people will just omit the error checking.

One way around that is to throw an exception. I'm not sure how I feel
about that, but I'll think about it.

---

## #121342 — Robert Landers — 2023-10-17T09:15:36+00:00

URL: https://externals.io/message/121313#121342 · In reply to: #121341

On Tue, Oct 17, 2023 at 11:10 AM Levi Morrison via internals
<internals@lists.php.net> wrote:
>
> > […]
>
> It's true that sentiment may have shifted in this time. However, a
> common argument at that time still stands: `null` is not a good
> sentintenal for failure because the value inside the array very well
> could have been null. This is not true for the keys. For me
> personally, I think I would still vote no. I'm not entirely sure about
> that, but that's how I would lean right now.
>
> As it stands, you'd have to write code along the lines of:
>
> ```php
> $key = \array_key_first($array);
> if ($key === null) {
>     // handle the failure
> } else {
>     // success
>     $value = $array[$key];
> }
> ```
>
> Yes, it would be slightly nicer if we could do:
>
> ```php
> $value = \array_first($array);
> if ($value === null) {
>     // handle the failure
> } else {
>     // success
> }
> ```
>
> But I fear in practice people will just omit the error checking.
>
> One way around that is to throw an exception. I'm not sure how I feel
> about that, but I'll think about it.
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php
>

How is returning null any different than $array[0] on an empty array?
https://3v4l.org/K3gRs

Currently, it just outputs a warning, but the result is `null`.

---

## #121343 — Lynn — 2023-10-17T09:21:49+00:00

URL: https://externals.io/message/121313#121343 · In reply to: #121342

On Tue, Oct 17, 2023 at 11:15 AM Robert Landers <landers.robert@gmail.com>
wrote:

> On Tue, Oct 17, 2023 at 11:10 AM Levi Morrison via internals
> <internals@lists.php.net> wrote:
>
> How is returning null any different than $array[0] on an empty array?
> https://3v4l.org/ <https://3v4l.org/K3gRs>>

> > […]
>
> It's true that sentiment may have shifted in this time. However, a
> common argument at that time still stands: `null` is not a good
> sentintenal for failure because the value inside the array very well
> could have been null. This is not true for the keys. For me
> personally, I think I would still vote no. I'm not entirely sure about
> that, but that's how I would lean right now.
>
> As it stands, you'd have to write code along the lines of:
>
> ```php
> $key = \array_key_first($array);
> if ($key === null) {
>     // handle the failure
> } else {
>     // success
>     $value = $array[$key];
> }
> ```
>
> Yes, it would be slightly nicer if we could do:
>
> ```php
> $value = \array_first($array);
> if ($value === null) {
>     // handle the failure
> } else {
>     // success
> }
> ```
>
> But I fear in practice people will just omit the error checking.
>
> One way around that is to throw an exception. I'm not sure how I feel
> about that, but I'll think about it.
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php

> > […]
>
> Currently, it just outputs a warning, but the result is `null`.
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>
I'm okay with `null` being given back as it's the current behavior of
accessing the key as well, which is often checked through `$array[0] ??
null`. Something like an `undefined` type could solve this problem, but
personally not a fan of this in Javascript. Maybe `array_has_first` or
something could be made, but honestly I would still just check for `null`
myself most likely.

---

## #121344 — Robert Landers — 2023-10-17T09:29:51+00:00

URL: https://externals.io/message/121313#121344 · In reply to: #121343

>
>
>
> 
> > […]
>
> > […]
>
> I'm okay with `null` being given back as it's the current behavior of accessing the key as well, which is often checked through `$array[0] ?? null`. Something like an `undefined` type could solve this problem, but personally not a fan of this in Javascript. Maybe `array_has_first` or something could be made, but honestly I would still just check for `null` myself most likely.

Huh, that's a good observation Lynn. If I might suggest an API change
to `array_value_first` (and a similar one for array_value_last), it
would be this: `array_value_first(array $array, string|int|null &$key
= null): mixed` where you also get back the key. If you want to know
if null is an error or an actual value:

$value = array_value_first($array, $key);
if($key === null) // handle error
else // do something with $value

You can also freely ignore the key, if you don't need it or care about
error checking. That would save doing two function calls on the same
array, just to do some error checking.

---

## #121345 — Aleksander Machniak — 2023-10-17T09:34:37+00:00

URL: https://externals.io/message/121313#121345 · In reply to: #121344

> $value = array_value_first($array, $key);
> if($key === null) // handle error
> else // do something with $value
> 
> You can also freely ignore the key, if you don't need it or care about
> error checking. That would save doing two function calls on the same
> array, just to do some error checking.
> 

Please, no. What's wrong with `count()` or empty()?

+1 for `array_first()` and `array_last()`. The only problem is probably a 
big BC break. I myself have `array_first()` defined in my framework.

-- 
Aleksander Machniak
Kolab Groupware Developer        [https://kolab.org]
Roundcube Webmail Developer  [https://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com

---

## #121346 — Robert Landers — 2023-10-17T09:37:20+00:00

URL: https://externals.io/message/121313#121346 · In reply to: #121345

>
> 
> > […]
>
> Please, no. What's wrong with `count()` or empty()?
>
> +1 for `array_first()` and `array_last()`. The only problem is probably a
> big BC break. I myself have `array_first()` defined in my framework.
>
> --
> Aleksander Machniak
> Kolab Groupware Developer        [https://kolab.org]
> Roundcube Webmail Developer  [https://roundcube.net]
> ----------------------------------------------------
> PGP: 19359DC1 # Blog: https://kolabian.wordpress.com
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php
>

Hey Aleksander,

> Please, no. What's wrong with `count()` or empty()?

Nothing. Why not either one? You don't have to use the $key variable
and you can use `count()` or empty(), but for me personally, it makes a
lot of sense.

---

## #121347 — Robert Landers — 2023-10-17T09:41:30+00:00

URL: https://externals.io/message/121313#121347 · In reply to: #121346

On Tue, Oct 17, 2023 at 11:37 AM Robert Landers
<landers.robert@gmail.com> wrote:
>
> 
> > […]
>
> Hey Aleksander,
>
> > […]
>
> Nothing. Why not either one? You don't have to use the $key variable
> and you can use `count()` or empty(), but for me personally, it makes a
> lot of sense.

Ah, I just realized why it makes a lot of sense, and that is when
Fibers get involved. The value and key could change underneath you
from one function call to another.

$key = array_key_first($this-array);

// call something that suspends a fiber and results in $this->array
being mutated

$value = array_value_first($this->array);

// $value and $key may now point to two totally separate things.

I've been bitten by this with Fibers a few times now (or things very
similar to it).

Having a way to atomically get $key and $value would be a boon, not a hindrance.

Robert Landers
Software Engineer
Utrecht NL

---

## #121350 — Ken Guest — 2023-10-17T15:16:44+00:00

URL: https://externals.io/message/121313#121350 · In reply to: #121347

Having array_value_first and array_value_last to match the existing
array_key_first and array_key_last functions make sense, and would seem to
me to be more intuitive than function names that would not match that
scheme.

On Tue, 17 Oct 2023 at 10:41, Robert Landers <landers.robert@gmail.com>
wrote:

> On Tue, Oct 17, 2023 at 11:37 AM Robert Landers
> <landers.robert@gmail.com> wrote:
> > […]
> wrote:
> > […]
> about
> > […]
>
> Ah, I just realized why it makes a lot of sense, and that is when
> Fibers get involved. The value and key could change underneath you
> from one function call to another.
>
> $key = array_key_first($this-array);
>
> // call something that suspends a fiber and results in $this->array
> being mutated
>
> $value = array_value_first($this->array);
>
> // $value and $key may now point to two totally separate things.
>
> I've been bitten by this with Fibers a few times now (or things very
> similar to it).
>
> Having a way to atomically get $key and $value would be a boon, not a
> hindrance.
>
> Robert Landers
> Software Engineer
> Utrecht NL
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php
>


-- 
http://about.me/kenguest/

---

## #121351 — Aimeos | Norbert Sendetzky — 2023-10-17T15:54:01+00:00

URL: https://externals.io/message/121313#121351 · In reply to: #121350

> Having array_value_first and array_value_last to match the existing
> array_key_first and array_key_last functions make sense, and would seem to
> me to be more intuitive than function names that would not match that
> scheme.

Please don't make things more complicated than they should be. Functions 
names should be short and memorable and `array_first()` and `array_last()` 
are perfect. No need for array_value_first() and array_value_last() just 
for the sake of matching with `array_key_first()` and `array_key_last()` 
functions.

Furthermore, returning `NULL` if the array contains no element is all we 
need in daily life because most often it doesn't matter if the array is 
empty or the first value is a `NULL` value. If it does, checking the array 
with empty() or using `array_filter()` is enough. No exceptions, warnings 
and notices please!

Always think of how you would use the functions in your own projects to 
write short and elegant code, not about all the special cases that 
should be handled separately.

Best,
Norbert


> On Tue, 17 Oct 2023 at 10:41, Robert Landers <landers.robert@gmail.com>
> wrote:
> 
> > […]
> 
> 

-- 
Norbert Sendetzky

Aimeos GmbH
Rennbahnstr. 32
DE-22111 Hamburg

E-Mail: norbert@aimeos.com
Phone:  +49 40 8668 4492
Web: aimeos.com

Trade register: District court Hamburg HRB 143090
Managing director: Norbert Sendetzky
VAT ID: DE302287839

---

## #121352 — Michael Cordover — 2023-10-17T16:06:08+00:00

URL: https://externals.io/message/121313#121352 · In reply to: #121341

> It's true that sentiment may have shifted in this time. However, a
> common argument at that time still stands: `null` is not a good
> sentintenal for failure because the value inside the array very well
> could have been null. 

What about a signature like:

```php
array_first(array $array, mixed $value_if_missing = null);
```

That would let you specify your own sentinel (or default) where appropriate, without losing the convenience of this function.

mjec

---

## #121353 — Saki Takamachi — 2023-10-17T16:19:30+00:00

URL: https://externals.io/message/121313#121353 · In reply to: #121352

> What about a signature like:
> 
> ```php
> array_first(array $array, mixed $value_if_missing = null);
> ```
> 
> That would let you specify your own sentinel (or default) where appropriate, without losing the convenience of this function.

This is a problem that should be addressed in your application.

```
array_first($arr) ?? $initial
```

I personally think we should make the effort to write it this way and not have to support initial values ​​at the language level.

Regards.

Saki

---

## #121354 — Michael Cordover — 2023-10-17T16:34:38+00:00

URL: https://externals.io/message/121313#121354 · In reply to: #121353

> > […]
>
> This is a problem that should be addressed in your application.
>
> ```
> array_first($arr) ?? $initial
> ```
>
> I personally think we should make the effort to write it this way and 
> not have to support initial values ​​at the language level.

The problem Levi mentioned is that there's ambiguity in this construction: if the valid data domain for elements of `$arr` includes `null`, then you can't tell whether the null comes from the array being empty, or from its first value being null. In other words, there exists application code where using `??` in this way is unsuitable.

I can think of three approaches for dealing with this, resulting in application code like:

```
$value = array_first($arr, $default);

$value = count($arr) > 0 ? array_first($arr) : $default;

try {
  $value = array_first($arr);
} catch (OutOfBoundsException $e) {
  $value = $default;
}
```

I think the first of those - what I initially suggested - is the cleanest.

mjec

---

## #121355 — Saki Takamachi — 2023-10-17T16:48:53+00:00

URL: https://externals.io/message/121313#121355 · In reply to: #121354

I see now, that makes sense.

There is also a technique to make the return value `[$key => $value]` instead of just a value, but this loses simplicity.

Thanks.

Saki

---

## #121361 — Brandon Jackson — 2023-10-17T18:42:59+00:00

URL: https://externals.io/message/121313#121361 · In reply to: #121355

> There is also a technique to make the return value `[$key => $value]` instead of just a value, but this loses simplicity.

Hmm, since the naming array_first and array_last doesn't clarify that
it's returning a key or a value. What if it returned both as ?[key,
value].

That opens quite a few use possibilities:
$first = array_first($array);
$value = $first[1] ?? throw new Exception();

[,$value] = array_first($array) ?? [null, null];
[,$value] = array_first($array) ?? throw new Exception();

---

Next page: https://externals.io/message/121313.md?page=2
