PHP function display
<p>Hello I have a four computers that I would like to ping before using.  The pinging is done via a PHP page with the following function.</p>

<pre><code>if (isset($_POST['playgroundcheck'])) {

    function ping($PGIP) {
        require_once "Net/Ping.php";
        $ping = Net_Ping::factory();
        if (PEAR::isError($ping))
            echo $ping -&gt; getMessage();
        else {
            /* Number of packets to send */
            $ping -&gt; setArgs(array('count' =&gt; 2));
            $pgData = $ping -&gt; ping($PGIP);
            //    print_r($pgData);

            if ($pgData -&gt; _received &gt; 0) {
                return true;
                //echo "&lt;h1&gt;&lt;font color=\"green\"&gt;ON&lt;/font&gt;&lt;/h1&gt;";
            } else {
                //echo "&lt;h1&gt;&lt;font color=\"red\"&gt;OFF&lt;/font&gt;&lt;/h1&gt;";
                return false;
            }

        }

    }

    $IP2sping = array("pc1" =&gt; "192.168.1.121", "pc2" =&gt; "192.168.1.122", "pc3" =&gt; "192.168.1.123", "pc4" =&gt; "192.168.1.124");

    foreach ($IP2sping as $key =&gt; $value) {

        if (ping($value) == true) {
            echo $key . " alive&lt;br&gt;";
        } else {
            echo $key . " off&lt;br&gt;";
        }
    }
}
</code></pre>

<p>I created a form to call the function with a submit button.  All of this works but my problems is trying to display the output outside the function.  For example currently all output is displayed like the following.</p>

<pre><code>pc1 alive
pc2 alive
pc3 alive
pc4 alive 
</code></pre>

<p>I want to know how the results of <code>pc1</code>, <code>pc2</code>, <code>pc3</code> and <code>pc4</code> can be displayed separately outside the function.</p>
