how insert value inner array

This is a discussion on how insert value inner array within the alt.comp.lang.php forums, part of the PHP Programming Forums category; if this work $var0['list'] = array( 'type1' => 'val1', 'type2' => 'val2', 'type3' => 'val3' ); is possible to have this: $...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 2 Weeks Ago
nawfer
 
Posts: n/a
Default how insert value inner array

if this work
$var0['list'] = array(
'type1' => 'val1',
'type2' => 'val2',
'type3' => 'val3'
);

is possible to have this:
$var0['list'] = array(
'type1' => 'val1',
'type2' => 'type3' => 'val2-3'
);

which is correct code ?
Reply With Quote
  #2 (permalink)  
Old 2 Weeks Ago
C.
 
Posts: n/a
Default Re: how insert value inner array

On 29 Apr, 12:16, nawfer <novalidsfors...@alt.al> wrote:
> if this work
> $var0['list'] = array(
> 'type1' => 'val1',
> 'type2' => 'val2',
> 'type3' => 'val3'
> );
>
> is possible to have this:
> $var0['list'] = array(
> 'type1' => 'val1',
> 'type2' => 'type3' => 'val2-3'
> );
>
> which is correct code ?


No - its syntactic and semantic garbage - and you haven't explained
what you are trying to acheive.

C.
Reply With Quote
  #3 (permalink)  
Old 1 Week Ago
Erwin Moller
 
Posts: n/a
Default Re: how insert value inner array

nawfer schreef:
> if this work
> $var0['list'] = array(
> 'type1' => 'val1',
> 'type2' => 'val2',
> 'type3' => 'val3'
> );


The above is valid PHP.

>
> is possible to have this:
> $var0['list'] = array(
> 'type1' => 'val1',
> 'type2' => 'type3' => 'val2-3'
> );


That is invalid.
What do you try to accomplish by that?

What do you expect the following line will produce:
echo $var0['type2'];

???

>
> which is correct code ?


The former.

But as C pointed out, we might be of more help if you describe what you
try to store in that array.

Regards,
Erwin Moller
Reply With Quote
  #4 (permalink)  
Old 1 Week Ago
Thomas Mlynarczyk
 
Posts: n/a
Default Re: how insert value inner array

nawfer schrieb:

> is possible to have this:
> $var0['list'] = array(
> 'type1' => 'val1',
> 'type2' => 'type3' => 'val2-3'
> );


$var0['list'] = array(
'type1' => 'val1',
'type2' => array( 'type3' => 'val2-3' )
);

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:39 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0