Skip to content

Instantly share code, notes, and snippets.

@mose
Created November 23, 2021 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mose/b4b1ea44051e335cdf741d1e9f56ef5f to your computer and use it in GitHub Desktop.
Save mose/b4b1ea44051e335cdf741d1e9f56ef5f to your computer and use it in GitHub Desktop.
<?php
foreach($data as $key => $row) {
$categories = array($row['Category']);
foreach($row as $h => $v) {
if (substr($h, 0, 3) == 'pr:') {
$cat = substr($h, 3);
if ($v != '') {
$categories[] = $cat;
}
unset($data[$key][$h]);
}
}
$data[$key]['Category'] = join(',', $categories);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment