Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15580 > unrolled thread
| Started by | alex <alex@nomailno.it> |
|---|---|
| First post | 2015-07-12 12:40 +0200 |
| Last post | 2015-07-14 11:09 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.php
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
| From | alex <alex@nomailno.it> |
|---|---|
| Date | 2015-07-12 12:40 +0200 |
| Subject | insert 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]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2015-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]
| From | Erwin Moller <erwinmollerusenet@xs4all.nl> |
|---|---|
| Date | 2015-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]
| From | alex <alex@nomailno.it> |
|---|---|
| Date | 2015-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