title: refactor PHP code to get data from local functions
body: <p>I've made some code to create form fields, now I have issues where i need to replicate switch statement for multi step forms, and I feel whenever I need to replicate code, I'm doing it wrong;</p>
  
  <pre><code>    // (var) HTML Content to be returned
      $content = '';
  
      /**
       * Output Single form fields
       */
      if (isset($_form['single'])) {
  
          // Get templates and content for the single step form, based on form type
          foreach ($_form['single'] as $_value) {
  
              switch ($_value[0]) {
                  case 'select':
                      $content .= $f_select($_value);
                      break;
                  case 'heading':
                      $content .= $f_heading($_value);
                      break;
                  case 'input':
                      $content .= $f_input($_value);
                      break;
                  case 'date':
                      $content .= $f_date($_value);
                      break;
                  case 'textarea':
                      $content .= $f_textarea($_value);
                      break;
                  case 'info':
                      $content .= $f_info($_value);
                      break;
              }
          }
      }
      return $content;
  </code></pre>
  
  <p>Any idea of how to refactor this so i could access data from variable functions from switch statement, so that i can do checks for  example if (isset($_form['multi'][0,1...])) {</p>