Note that there are some explanatory texts on larger screens.

plurals
  1. POreturn 2 values ​​in a function and get the 2 values ​​in another function in the same class
    text
    copied!<p>well, my question is this, I need to calculate the percentage of 2 values ​​and whether up or down on an arrow. okay so i created two functions for veirificar, Arrow and percentage that are.</p> <pre><code>private function porcentagem($a,$b){ $re = $b * 100 / $a; return print round($re,0)."%"; } private function seta($a,$b){ if($a &lt; $b){ return "up"; }else{ return "down"; } } </code></pre> <p>I created a function that returns the data to an array, to become more organized.</p> <pre><code>private static function retornar($a,$b){ return array($a,$b); } </code></pre> <p>Now the function that checks the data for category :</p> <pre><code>private function new_user(){ $q = mysql_query("SELECT * FROM usu4r10s WHERE premium IS NULL AND " . $this-&gt;antes); $a = mysql_num_rows($q); $q = mysql_query("SELECT * FROM usu4r10s WHERE premium IS NULL AND " . $this-&gt;depois); $b = mysql_num_rows($q); return self::retornar($this-&gt;porcentagem($a,$b),$this-&gt;seta($a,$b)); } </code></pre> <p>remembering that "antes" and "depois" is a variable to become more organized.</p> <pre><code>var $antes = "DATEDIFF(NOW(), `data`) &lt; 30"; var $depois = "DATEDIFF(NOW(), `data`) &lt; 0"; </code></pre> <p>now the final function I'm having problems.</p> <pre><code>public function _build(){ $output = ' &lt;span class="mws-report-content"&gt;'. ' &lt;span class="mws-report-title"&gt;Novos Usuários&lt;/span&gt;'. ' &lt;span class="mws-report-value '.$this-&gt;contas_premiuns(array(0)).'"&gt;'.$this-&gt;contas_premiuns(array(1)).'&lt;/span&gt;'. ' &lt;/span&gt;'; try{ return print $output; }catch (Exception $e){ return print $e; } } </code></pre> <p>the only problem is that I do not know how to return 2 values ​​in a function, please help me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload