title: Use return of function directly without a variable
body: <p>Sorry for my english, can't find the correct words on Google to find why it acts like this. Must be very easy to solve!</p>
  
  <p>I'm using PHP 7 and I want to use the return provided by a function for a query (bind it). If I call directly the function in my bind function, it returns nothing. If I call it outside, like $var = function($a) and use $var into the bind function, it works.</p>
  
  <p>I don't get why I can't use directly the function? If I do this in the parameters of a function (like function getID($this->getName(1))) it works. why it doesn't here? The code:</p>
  
  <p><strong>Doesn't work</strong></p>
  
  <pre><code>        $this-&gt;bdd-&gt;query("UPDATE stats_of_the_days
                              SET winner_firstsolves = :winner_fs
                              WHERE id = :stat_id");
  
          $this-&gt;bdd-&gt;bind("winner_fs", $this-&gt;getTodayWinnerFs($winnerID), PDO::PARAM_INT);
          $this-&gt;bdd-&gt;bind("stat_id", $statID, PDO::PARAM_INT);
  
          $this-&gt;bdd-&gt;execute();
  </code></pre>
  
  <p><strong>Works (using a variable to call/store the function/return)</strong></p>
  
  <pre><code>    $var = $this-&gt;getTodayWinnerFs($winnerID);
  
      $this-&gt;bdd-&gt;query("UPDATE stats_of_the_days
                          SET winner_firstsolves = :winner_fs
                          WHERE id = :stat_id");
  
      $this-&gt;bdd-&gt;bind("winner_fs", $var, PDO::PARAM_INT);
      $this-&gt;bdd-&gt;bind("stat_id", $statID, PDO::PARAM_INT);
  
  
      $this-&gt;bdd-&gt;execute();
  </code></pre>
  
  <p><strong>The function is pretty basic</strong></p>
  
  <pre><code>public function getTodayWinnerFs($userID)
      {
        // query stuff
        return $this-&gt;bdd-&gt;resultObj()-&gt;Wins;
      }
  </code></pre>
  
  <p><strong>Example of return of the function</strong></p>
  
  <pre><code>var_dump($this-&gt;getTodayWinnerFs(494));
  // string(2) "13"
  </code></pre>
  
  <p><strong>The "bind" function from my db pdo class</strong></p>
  
  <pre><code>        public function bind($param, $value, $type = null)
          {
              if (is_null($type)) {
                  switch (true) {
                      case is_int($value):
                          $type = PDO::PARAM_INT;
                          break;
                      case is_bool($value):
                          $type = PDO::PARAM_BOOL;
                          break;
                      case is_null($value):
                          $type = PDO::PARAM_NULL;
                          break;
                      default:
                          $type = PDO::PARAM_STR;
                  }
              }
              $this-&gt;stmt-&gt;bindValue($param, $value, $type);
          }
  </code></pre>
  
  <p>Thank you!</p>