fork download
  1. <?php
  2. $arr = array ( 'last_modified' => 'input', 'published' => 'input', 'project_content' => 'textarea' );
  3. $result = array();
  4. foreach($arr as $k => $v) {
  5. if (array_key_exists($v, $result)) {
  6. $result[$v][] = $k;
  7. } else {
  8. $result[$v] = array($k);
  9. }
  10. }
  11. print_r($result);
  12. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [input] => Array
        (
            [0] => last_modified
            [1] => published
        )

    [textarea] => Array
        (
            [0] => project_content
        )

)