0

Is it possible to make a while loop for a function but in stead of just echo it's result, store it in an array???
values in database for example: one, two, three, four.

In a normal way I do:

While (havenumbers()) {
echo havenumber(); // displays "one" etc.
}

In stead of the echo I would like to store this in an array:

$myarray = array('one','two','three','four');
3
Contributors
4
Replies
17
Views
4 Years
Discussion Span
Last Post by paulkd
1
$r = array();
while (havenumbers()) {
    $r[] = havenumber(); // displays "one" etc.
}
0

Updated, I missed a function inside the while loop:

In a normal way I do:

While (havenumbers()) {
echo **mynumber()**; // displays "one" etc.
}

In stead of the echo I would like to store this in an array:

$myarray = array('one','two','three','four');
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.