Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Newsgroups | alt.php |
|---|---|
| Date | 2015-09-22 11:47 -0700 |
| References | <mnrp3s$6b9$1@speranza.aioe.org> |
| Message-ID | <3efe278e-7d2c-4ec6-9d79-c4c4c28ba194@googlegroups.com> (permalink) |
| Subject | Re: foreach with array key value |
| From | BAHC <alexwans@gmail.com> |
$myarray = [2, 10];
$app = array_values($myarray);
$i = count($myarray);
while($i) {
fty($op, $app);
$i--;
}
function fty($op, $app){ ...do your operation with $app array... }
суббота, 11 июля 2015 г., 22:00:35 UTC+3 пользователь alex написал:
> In this function
>
> function fty($op, $t= array())
> {
> ...
> }
>
>
> inner with a print_r of $t
> I have this
> Array (
> [0] => 2
> [1] => 10
> )
>
>
> I need to call same function more time with a cicle
> but not know how to do
>
> only so work:
>
> for test I created one my array with [0] => 2 and [1] => 10
> but work only if I write so:
>
> $n=0;
> foreach ($myarr as $key_g => $t_g) {
> $app[$n++] = $t_g;
> };
> foreach ($myarr as $key_g => $t_g) {
> fty($op, $app);
> };
>
> how can call the function directly not using the first loop;
> loop that reconstructs only the pair key value thet I already have
Back to alt.php | Previous | Next — Previous in thread | Find similar
foreach with array key value alex <alex@nomailno.it> - 2015-07-11 21:00 +0200 Re: foreach with array key value alex <alex@nomailno.it> - 2015-07-11 21:25 +0200 Re: foreach with array key value BAHC <alexwans@gmail.com> - 2015-09-22 11:47 -0700
csiph-web