Arrays and Functions
| From: | Brian C. Doyle | Date: | Mon, 11 Sep 2000 12:31:52 +0000 |
| Subject: | Arrays and Functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16159@lists.php.net to get a copy of this message | ||
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];
}
?>