title: Create function inside function to send e-mail
body: <p>I have a problem with functions. I create functions to send e-mails. I'm trying to create function, for example: I call function with variable ($product_id), and depends on this product id, I would like to send e-mails.</p>
  
  <pre><code>&lt;?php
  $product_id = 2000;
  echo select_users_to_send($product_id);
  
  function get_product_type($id_product){
      // Define product group
      global $wpdb;
      $sql = "SELECT n_products.Product_Group
  FROM tsales_funnel_mrecord
  LEFT JOIN n_products on tsales_funnel_mrecord.Product_type = n_products.Product_Code
  WHERE ID = $id_product";
      $type_product = $wpdb-&gt;get_var($sql);
      return $type_product;
  }
  function select_users_to_send($type = get_product_type($product_id)){
      return $type.' user';
  }
  
  ?&gt;
  </code></pre>
  
  <p>I wrote this code, but it didn't works for me. Shows error:</p>
  
  <pre><code>Parse error: syntax error, unexpected '(', expecting ')'
  </code></pre>
  
  <p>Maybe there need to use classes? But I didn't understand how to write classes.</p>