Re: [PHP] Echo a value from an arrays position

2006-05-07 Thread Jochem Maas
Dave Goodchild wrote: This may clarify - in php, integer and associate arrays are created arbitrarily, ie keys can be numbers or strings. So, either create an array like this: array('1' => 'first element', '2' => 'second element'); if I'm not mistaken the above example will result in an

Re: [PHP] Echo a value from an arrays position

2006-05-05 Thread Eric Butera
On 5/4/06, Brad Bonkoski <[EMAIL PROTECTED]> wrote: Will this also work with an associative array? If this is what he is talking about, I tried it and it does not work I put this together though and it works, not sure if it is the *best* way though... '#ff','black'=>'#00','blue'=>

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 9:09 am, John Wells wrote: > On 5/4/06, Ford, Mike <[EMAIL PROTECTED]> wrote: >> They're not even that. They're pure associative arrays, or maps -- >> it's just that integer keys are treated somewhat specially so that >> an array with *only* integer keys will look like a traditi

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 7:24 am, Jonas Rosling wrote: > Is there any way to call for an element value in an array by the > position? > Like position 2 in the array and not the key name. You DEFINITELY need to re-read the Array section of the manual. Because you either didn't read it, or didn't unders

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread John Wells
On 5/4/06, Ford, Mike <[EMAIL PROTECTED]> wrote: They're not even that. They're pure associative arrays, or maps -- it's just that integer keys are treated somewhat specially so that an array with *only* integer keys will look like a traditional array. True true, thanks for making it crystal

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Ford, Mike
On 04 May 2006 13:52, John Wells wrote: > On 5/4/06, Brad Bonkoski <[EMAIL PROTECTED]> wrote: > > Will this also work with an associative array? If this is what he > > is talking about, I tried it and it does not work > > > > I think you're correct. This is because PHP arrays are a "mash-u

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] > $colors = > array('white'=>'#ff','black'=>'#00','blue'=>'#ff'); > foreach($colors AS $key => $value){ > echo $value . "\n"; > } > But I don't get anything out of this code. Why? Doesn't echo anything? [/snip] Seriously? Works fine here. -- PHP General Mailing List (http://w

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] Lasso can do the following, can PHP? Size; Output: '' + $Colors->(Get: Loop_Count),-EncodeNone; /Loop; ?> This outputs; ff 00ff00 ff I'm new at PHP but not Lasso that's why I'm for you asking odd questions. [/snip] 1. Always respond to the list as a single use

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] Seem like your missunderstanding me. I'm not using an orignal array. I'm using an "map-array". $array = ('element' = 'value'); [/snip] It is called an associative array, a value is associated with a key. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.p

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] Of course getting an indexed value into an associative array seems a bit odd to me... maybe Jonas could shed some light on why he would go this route... [/snip] Exactly [snip] To get a value from position 2 in an array you use $arrayName[1] (all array elements start numbering at 0,

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread John Wells
On 5/4/06, Brad Bonkoski <[EMAIL PROTECTED]> wrote: Will this also work with an associative array? If this is what he is talking about, I tried it and it does not work I think you're correct. This is because PHP arrays are a "mash-up" (as Jochem put it) of numerical indexes/hashtables/as

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Dave Goodchild
This may clarify - in php, integer and associate arrays are created arbitrarily, ie keys can be numbers or strings. So, either create an array like this: array('1' => 'first element', '2' => 'second element'); and call by the key! On 04/05/06, Jonas Rosling <[EMAIL PROTECTED]> wrote: I

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Brad Bonkoski
Nope... dead air. Of course getting an indexed value into an associative array seems a bit odd to me... maybe Jonas could shed some light on why he would go this route... Jay Blanchard wrote: [snip] I get nothing do you get something different? [/snip] Not even 'array'? -- PHP

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jonas Rosling
Nothing. // Jonas Den 06-05-04 14.40, skrev "Jay Blanchard" <[EMAIL PROTECTED]>: > [snip] > $colors = > array('white'=>'#ff','black'=>'#00','blue'=>'#ff'); > [/snip] > > What happens when you echo $colors[1]? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, vi

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] I get nothing do you get something different? [/snip] Not even 'array'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Brad Bonkoski
I get nothing do you get something different? Jay Blanchard wrote: [snip] $colors = array('white'=>'#ff','black'=>'#00','blue'=>'#ff'); [/snip] What happens when you echo $colors[1]? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.ph

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] $colors = array('white'=>'#ff','black'=>'#00','blue'=>'#ff'); [/snip] What happens when you echo $colors[1]? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jonas Rosling
Seem like your missunderstanding me. I'm not using an orignal array. I'm using an "map-array". $array = ('element' = 'value'); // Jonas Den 06-05-04 14.29, skrev "Jay Blanchard" <[EMAIL PROTECTED]>: > [snip] > Is there any way to call for an element value in an array by the > position? > Like

Re: [PHP] Echo a value from an arrays position

2006-05-04 Thread Brad Bonkoski
Will this also work with an associative array? If this is what he is talking about, I tried it and it does not work I put this together though and it works, not sure if it is the *best* way though... $colors = array('white'=>'#ff','black'=>'#00','blue'=>'#ff');

RE: [PHP] Echo a value from an arrays position

2006-05-04 Thread Jay Blanchard
[snip] Is there any way to call for an element value in an array by the position? Like position 2 in the array and not the key name. [/snip] I hate to say this, but you really need to RTFM http://www.php.net/array To get a value from position 2 in an array you use $arrayName[1] (all array element

[PHP] Echo a value from an arrays position

2006-05-04 Thread Jonas Rosling
Is there any way to call for an element value in an array by the position? Like position 2 in the array and not the key name. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php