fork download
  1. <?php
  2.  
  3. $a = array(
  4. (object) array("id" => 1),
  5. (object) array("id" => 3),
  6. (object) array("id" => 5),
  7. (object) array("id" => 6),
  8. (object) array("id" => 7)
  9. );
  10.  
  11. $b = array(
  12. (object) array("id" => 1),
  13. (object) array("id" => 3),
  14. (object) array("id" => 5),
  15. (object) array("id" => 6),
  16.  
  17. );
  18.  
  19. $result = array_map(
  20. 'unserialize',
  21. 'serialize',
  22. $a
  23. ),
  24. 'serialize',
  25. $b
  26. )
  27. )
  28. );
  29.  
  30. print_r($result);
  31.  
  32. ?>
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
Array
(
    [0] => stdClass Object
        (
            [id] => 1
        )

    [1] => stdClass Object
        (
            [id] => 3
        )

    [2] => stdClass Object
        (
            [id] => 5
        )

    [3] => stdClass Object
        (
            [id] => 6
        )

)