We help IT Professionals succeed at work.

What is the java linkedhashmap equivalent in php? Array? Need a good example with keys.

glynco
glynco asked
on
Anyone can give a good example of a linkedhashmap equivalent in php?

Need a good example with keys.
Comment
Watch Question

CERTIFIED EXPERT

Commented:
There is nothing explicitly like Java's linked hash tables - PHP arrays are just simple associative arrays. PHP 5 does have a standard library that may get yu some way towards your goal. See http://uk3.php.net/spl and perhaps one of the HEAP classes.

Maybe a more pertinent question is why you would need such a structure in the first place? PHP is not performance oriented in the same way Java is because with PHP running on a server with almost no user interaction (compared to a GUI) there is little need for such complexity.
Commented:
foreach ($articles['Article'] as $my_object)
{
    $title = (string)$my_object->title;
    $my_associative_array[$title] = $my_object;
}

Author

Commented:
This is what close to linkedhashmap with key and the objects in each key.