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


Groups > comp.lang.php > #15584

Re: insert directly key value in a function

From alex <alex@nomailno.it>
Newsgroups comp.lang.php
Subject Re: insert directly key value in a function
Date 2015-07-14 11:09 +0200
Organization Aioe.org NNTP Server
Message-ID <mo2jkl$epg$2@speranza.aioe.org> (permalink)
References <mntg6a$da6$1@speranza.aioe.org> <55a3c9dd$0$2920$e4fe514c@news2.news.xs4all.nl>

Show all headers | View raw


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



Back to comp.lang.php | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

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

csiph-web