Declaring a function in a function in php
<p><strong>The code:</strong>    </p>

<pre><code>public function couts_complets($chantier,$ponderation=100){

    function ponderation($n)
    {
        return($n*$ponderation/100); //this is line 86
    }

            ...

    }
</code></pre>

<p><strong>What I'm trying to do:</strong> to declare a function B inside a function A in order to use it as a parameter in<br>
                            array_map().</p>

<p><strong>My problem:</strong>  I get an error:</p>

<blockquote>
  <p>Undefined variable: ponderation [APP\Model\Application.php, line 86]</p>
</blockquote>
