fork download
  1. <?php
  2. $foo = array(
  3. (object) array("test" => "123.123.123"),
  4. (object) array("test" => "312.312.312"),
  5. (object) array("test" => "456.456.456"),
  6. (object) array("test" => "789.789.789")
  7. );
  8.  
  9. print_r($foo);
  10.  
  11.  
  12. $bar = array_map(function ($n) {
  13. return $n->test;
  14. }, $foo);
  15.  
  16. print_r($bar);
  17. ?>
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
Array
(
    [0] => stdClass Object
        (
            [test] => 123.123.123
        )

    [1] => stdClass Object
        (
            [test] => 312.312.312
        )

    [2] => stdClass Object
        (
            [test] => 456.456.456
        )

    [3] => stdClass Object
        (
            [test] => 789.789.789
        )

)
Array
(
    [0] => 123.123.123
    [1] => 312.312.312
    [2] => 456.456.456
    [3] => 789.789.789
)