php if return == false echo something
<p>I'm using a include file to translate my text. it works pretty good, but now I need to on button click translate some mor words, and return doesn't work anymore, but echo does.</p>

<p>so what I'm searching is a way of know if return is possible or not, code example</p>

<pre><code>for ($i = 0; $i &lt; count($palavras); $i++) {
    if ($palavras[$i] == $palavra) {
        if($lingua == 1) {
            return $traducao_1[$i];
        }
        if($lingua == 2) {
            return $traducao_2[$i];
        }
    }
}
</code></pre>

<p>this one works good first time page is executed, since this is included file.</p>

<p>how to make this?</p>

<pre><code>if(!return $traducao_1[$i]) {
</code></pre>

<p>thanks</p>

<p>ok, tryed to answer, but always got an error, so I'm editing this as answer</p>

<p>Thank you all for help, I manage a way of make it work like adding one action to the function and checking if action == , then do something, like this</p>

<pre><code>function test($palavra, $lingua, $accao) {
for ($i = 0; $i &lt; count($palavras); $i++) {
    if ($palavras[$i] == $palavra) {
        if($lingua == 1) {
            if($accao != "2_chamada") {
                return $traducao_1[$i];
            } else {
                echo $traducao_1[$i];
            }
        }
    }
}
</code></pre>

<p>}</p>

<p>Again, thanks for help</p>
