Re: Arrays and Functions

From: Date: Mon, 11 Sep 2000 23:54:15 +0000
Subject: Re: Arrays and Functions
Groups: php.general 
Request: Send a blank email to php-general+get-16255@lists.php.net to get a copy of this message
You could either use $GLOBAL["array1"] or pass it by reference to the function. You can also increment using the c-style ++ operator :) John
From: "Brian C. Doyle" <bcdoyle@mindspring.com> To: php-general@lists.php.net Subject: [PHP] Arrays and Functions Date: Mon, 11 Sep 2000 08:31:52 -0400 Hello all, Is it possible to increment and array inside of a function and then call the array out side of the funciton. While in side the function I am able to echo the array and see what I should see out side of the funtion! Would I need to use global???? <? function alpha($a1) {
        $a = $a1;
        for ($i=$a;$i<10;$i++) {
                $array1[$i] = $array1[$i] + 1;
                }
        return;
        };
for ($i=0;$i<10;$i++) {
        $array1[$i] = 0;
        };
alpha(0); ?> Hello world!!! <?
        for ($i=0;$i<10;$i++) {
                echo "<br>The number is :".$array1[$i];
                }
?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.

« previous php.general (#16255) next »