Answer the question
In order to leave comments, you need to log in
How to select certain arrays by keys in an array?
How to select only arrays with certain formats in this array: "mp4, video, 720p", "mp4, video, 480p" ?
array (
array(
"url" => "tut url",
"format" => "mp4, video, 720p"
),
array(
"url" => "tut url",
"format" => "mp4, video, 480p"
),
array(
"url" => "tut url",
"format" => "mp4, video, 360p"
)
)
Answer the question
In order to leave comments, you need to log in
FANTASANTA
$arr = [
[
"url" => "tut url",
"format" => "mp4, video, 720p"
],
[
"url" => "tut url",
"format" => "mp4, video, 480p"
],
[
"url" => "tut url",
"format" => "mp4, video, 360p"
]
];
$arr = array_filter($arr, function($a){
return $a['format'] == "mp4, video, 720p" || $a['format'] == "mp4, video, 480p";
});
var_dump($arr);
?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question