Re: [PHP] convert associative array to ordinary array



On Fri, Mar 28, 2008 at 10:33 AM, Daniel Brown <parasane@xxxxxxxxx> wrote:
On Fri, Mar 28, 2008 at 2:27 PM, It Maq <itmaqurfe@xxxxxxxxx> wrote:
> Hi,
>
> i have an associative array and i want to use it as an
> ordinary array, is that possible?
>
> what i mean is instead of $arr['fruit'] i want to call
> it by its position in the array $arr[3]

Did you try?

--
</Daniel P. Brown>
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283




$numbered_array = array_values($associative_array);

--
-Casey
.



Relevant Pages

  • Duck Typed Concepts for Ruby (was Re: A use case for an ordered hash)
    ... An Sequencable mixin can be defined that implements all sorts of operations such as append, concat, splice, sort, etc. ... extending an instance of Array with Sorted if the array is known to be sorted. ... Now returning to the thread at hand we can see that the difference between the associative array and hash hierarchies is that the hash hierarchy depends upon Hashable keys. ...
    (comp.lang.ruby)
  • Re: Returning a Dictionary from a webservice
    ... There is no such thing as "associative array" in XML Schema. ... If a client needs to access this data in an associative manner, ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: newbie: "array" of problems :( eech!
    ... In javascript it is possible to add named properties to all objects at runtime by assigning values to those properties, and then retrieve those values with the property names. ... Differing from ordinary objects in that if the property names used with them are "length" or an 'array index' assignments to those property names may have side effects. ... The problems with treating javascript objects as an "associative array" is that no javascript objects are ever 'empty'. ...
    (comp.lang.javascript)
  • Re: COMMON structures and text parsing
    ... The place where this choice is not "cleaner" is when you need to ... index into an array using a logical value. ... Logicals do not. ... do an associative array of logicals and do it "right", ...
    (comp.lang.fortran)
  • Re: How to assign variable value as the object property name?
    ... > JavaScript by itself has Array and Map Table ("Hash" trigs many people ... Let's agree that arrays are an abstraction, ... The difference between Java and Javascript is (among other ... of an associative array, since it doesn't start out empty. ...
    (comp.lang.javascript)