Filter some values from an array in a serialized post_meta (PHP)

一曲冷凌霜 提交于 2019-12-02 04:24:26

Array filter was a good try, did you do it like this :

$channel = 'trance';
$show_data = array_filter($show_data, function($data) use ($channel) {
    return $data['channel'] == $channel;
});

You can do it by array_filter() using any key has value.

For e.g Channel => trance then it will return matched arrays.

$value = 'trance';
$key = 'channel';

$show_data = array_filter($array, function($itrate) use ($value,$key) {
    return $itrate[$key] == $value;
});

See : Live Demo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!