I'd like to sort 4 arrays that are enclosed within 1 array, but I have no clue how to do it.
$poster = [];
$character = [];
$title = [];
$date = [];
foreach($person->getMovieCredits()->getCast() as $movie)
{
array_push($poster, $movie->getPosterPath());
array_push($character, $movie->getCharacter());
array_push($title, $movie->getTitle());
array_push($date, $movie->getReleaseDate()->format('Y'));
}
$personArray = [
'date' => $date,
'title' => $title,
'character' => $character,
'poster' => $poster
];
The thing is that I would like to sort them by date, but not losing data integrity with other arrays.
How should I do that?
via Cookie