title: PHP - Call object methods dynamically via variables
body: <p>I am trying to unit-test some of my code and it would be easier to just call my setters dynamically based on some variables. Unfortunately my approach does not work as expected and I couldn't find more information regarding on how to do that.</p>
  
  <p>I have one variable which always is a string. It is used as property name and together with the "set" keyword it should result in "setSomething" or "setSomethingElse".</p>
  
  <p>I already tried</p>
  
  <pre class="lang-php prettyprint-override"><code>$obj-&gt;set{$property}($value);
  // or
  $obj-&gt;set$property($value);
  </code></pre>
  
  <p>But those do not seem to work.</p>
  
  <p>Maybe someone of you pro's know the right approach ;)!</p>