<?php
$array = [
[
'tag' => 'meta',
'type' => 'complete',
'attributes' => ['property' => 'og:type', 'content' => 'website']
],
[
'tag' => 'meta',
'type' => 'complete',
'attributes' => ['name' => 'robots', 'content' => 'noindex, nofollow']
],
[
'tag' => 'meta',
'type' => 'complete',
'attributes' => ['name' => 'application', 'content' => 'My Application']
],
[
'tag' => 'meta',
'type' => 'complete',
'attributes' => ['http-equiv' => 'content-type', 'content' => 'text/html; charset=utf-8']
]
];
foreach ($array as ['attributes' => $attr]) {
foreach ($attr as $keys[] => $values[]) {
break;
}
}
array_multisort($keys, $values, $array);
var_export($array);
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- array (
0 =>
array (
'tag' => 'meta',
'type' => 'complete',
'attributes' =>
array (
'http-equiv' => 'content-type',
'content' => 'text/html; charset=utf-8',
),
),
1 =>
array (
'tag' => 'meta',
'type' => 'complete',
'attributes' =>
array (
'name' => 'application',
'content' => 'My Application',
),
),
2 =>
array (
'tag' => 'meta',
'type' => 'complete',
'attributes' =>
array (
'name' => 'robots',
'content' => 'noindex, nofollow',
),
),
3 =>
array (
'tag' => 'meta',
'type' => 'complete',
'attributes' =>
array (
'property' => 'og:type',
'content' => 'website',
),
),
)
preferences:
106.85 ms | 408 KiB | 5 Q