Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 622
  • Last Modified:

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

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

Need a good example with keys.
0
glynco
Asked:
glynco
  • 2
1 Solution
 
Beverley PortlockCommented:
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.
0
 
glyncoAuthor Commented:
foreach ($articles['Article'] as $my_object)
{
    $title = (string)$my_object->title;
    $my_associative_array[$title] = $my_object;
}
0
 
glyncoAuthor Commented:
This is what close to linkedhashmap with key and the objects in each key.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now