Home › Forums › General Issues › Can a Select field's value be used to create an array? › Reply To: Can a Select field's value be used to create an array?
you could enter something like
title:Jaws,year:1975,genre:Thriller
as a value and then do something like
$movie_array = array();
$movie = get_sub_field('movie');
$list = explode(',', $movie);
foreach ($list as $value) {
$parts = explode(':', $value);
$movie_array[$parts[0]] = $parts[1];
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.