title: How to avoid too many arguments when calling functions in php
body: <p>Is there a way to avoid too many arguments when calling a function?</p>
  
  <pre><code>Eg:
  function myFunction($usrName,$usrCountry,$usrDOB//and many more){
      // Do something with all those arguments here
  }
  </code></pre>
  
  <p>One way I do this is to define constants</p>
  
  <pre><code>//After thorough checking
  
  $sesUserName = $_SESSION['sesUserName'];
  
  define('USERNAME', $sesUserName);
  
  myFunction(){
      // Do something with USERNAME here
      // No need to use USERNAME when calling the function
  }
  </code></pre>
  
  <p>But are there other ways to do this?</p>