Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #15580 > unrolled thread

insert directly key value in a function

Started byalex <alex@nomailno.it>
First post2015-07-12 12:40 +0200
Last post2015-07-14 11:09 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  insert directly key value in a function alex <alex@nomailno.it> - 2015-07-12 12:40 +0200
    Re: insert directly key value in a function Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-12 20:07 +0000
    Re: insert directly key value in a function Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-07-13 16:23 +0200
      Re: insert directly key value in a function alex <alex@nomailno.it> - 2015-07-14 11:09 +0200

#15580 — insert directly key value in a function

Fromalex <alex@nomailno.it>
Date2015-07-12 12:40 +0200
Subjectinsert directly key value in a function
Message-ID<mntg6a$da6$1@speranza.aioe.org>
I have this array $myarr
Array (
[0] => 2
[1] => 10
  )

and this work
foreach ($myarr as $key_g => $t_g) {
     fty($op, $myarr);
     };



if array is with only one element
Array (
[0] => 2
)

the foreach work ;
but seen that there is only one element how
can insert the directly the pair key value in the parameter (how do the 
loop)

call directly the function
fty($op, $myarr...... );

[toc] | [next] | [standalone]


#15581

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-07-12 20:07 +0000
Message-ID<mnuhdj$5qo$1@dont-email.me>
In reply to#15580
On Sun, 12 Jul 2015 12:40:12 +0200, alex wrote:

> I have this array $myarr Array (
> [0] => 2 [1] => 10
>   )
> 
> and this work foreach ($myarr as $key_g => $t_g) {
>      fty($op, $myarr);
>      };
> 
> if array is with only one element Array (
> [0] => 2 )
> 
> the foreach work ;
> but seen that there is only one element how can insert the directly the
> pair key value in the parameter (how do the loop)
> 
> call directly the function fty($op, $myarr...... );

Sorry, but I don't understand the problem and the code you're giving 
doesn't help explain it.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#15582

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2015-07-13 16:23 +0200
Message-ID<55a3c9dd$0$2920$e4fe514c@news2.news.xs4all.nl>
In reply to#15580
On 7/12/2015 12:40 PM, alex wrote:
> I have this array $myarr
> Array (
> [0] => 2
> [1] => 10
>   )

OK.

>
> and this work
> foreach ($myarr as $key_g => $t_g) {
>      fty($op, $myarr);
>      };
>
>

Good.
But we do not know what either fty() function is or the $op variable.


>
> if array is with only one element
> Array (
> [0] => 2
> )
>
> the foreach work ;

Good.
(By the way: It should even work on an empty array.)

> but seen that there is only one element how
> can insert the directly the pair key value in the parameter (how do the
> loop)
>
> call directly the function
> fty($op, $myarr...... );

As far as I can tell there is no difference with an array holding 2 
elements.

Could you describe your problem in more detail, or post more code?

Regards,
Erwin Moller

-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens

[toc] | [prev] | [next] | [standalone]


#15584

Fromalex <alex@nomailno.it>
Date2015-07-14 11:09 +0200
Message-ID<mo2jkl$epg$2@speranza.aioe.org>
In reply to#15582
Il 13/07/2015 16:23, Erwin Moller ha scritto:
> On 7/12/2015 12:40 PM, alex wrote:
>> I have this array $myarr
>> Array (
>> [0] => 2
>> [1] => 10
>>   )
>
> OK.
>
>>
>> and this work
>> foreach ($myarr as $key_g => $t_g) {
>>      fty($op, $myarr);
>>      };
>>
>>
>
> Good.
> But we do not know what either fty() function is or the $op variable.
>
>
>>
>> if array is with only one element
>> Array (
>> [0] => 2
>> )
>>
>> the foreach work ;
>
> Good.
> (By the way: It should even work on an empty array.)
>
>> but seen that there is only one element how
>> can insert the directly the pair key value in the parameter (how do the
>> loop)
>>
>> call directly the function
>> fty($op, $myarr...... );
>
> As far as I can tell there is no difference with an array holding 2
> elements.
>
> Could you describe your problem in more detail, or post more code?

solution was/is very simple

fty($op, $myarr);

seen that there is only one element isn't necssary the cicle or
use a specific php function for call the array with only on element



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web