If I have this array:
//$myarray
Array (
[0] => Array (
[b163cb25371a1b7c550d8f69fe211cc8] => Array (
[unique_key] => 14f74cf38563b889386beeec511033e2
[thwepof_options] => Array (
[order_date] => Array (
[name] => order_date
[value] => 1
[label] => Szállítási nap
[options] =>
)
)
)
)
)
How can I write a sorting method which sort the values by order_date [value]
I've tried first to get the array column like this but didn't got any return value:
<?php
$days = array_column($myarray[0]['thwepof_options'], 'value', 'order_date');
?>
You are skipping the 2nd level key. Here's a working version of your code:
<?php
$myarray = Array (
0 => Array (
'b163cb25371a1b7c550d8f69fe211cc8' => Array (
'unique_key' => '14f74cf38563b889386beeec511033e2',
'thwepof_options' => Array (
'order_date' => Array (
'name' => 'order_date',
'value' => 1,
'label' => 'Szállítási nap',
'options' => null
)
)
)
)
);
$days = array_column($myarray[0]['b163cb25371a1b7c550d8f69fe211cc8']['thwepof_options'], 'value', 'order_date');
print_r($days);
Also, this thing looks to me like it would make more sense as an object.