Home › Forums › General Issues › ACF Checkbox Field in array() › Reply To: ACF Checkbox Field in array()
Hi @unbekannter
The below will output the selected checkboxes into an array:
$values = array();
$time = get_field('second-field');
foreach ($time as $second) {
$values[] = '"'.$second.'" => 0';
}
echo implode(',', $values);
Do you need it as an associative array? I’m trying to work out it out.
You asked for checkboxes to be an array but the example you give of how it needs to be is more like an associative array (I believe but could be wrong!).
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.