fork download
  1. <?php
  2. $a = new stdClass();
  3. $a->id = 2;
  4. $a->position = 'am';
  5. $a->label = 'Account manager';
  6. $b = new stdClass();
  7. $b->id = 2;
  8. $b->position = 'am';
  9. $b->label = 'Account manager';
  10. $c = new stdClass();
  11. $c->id = 2;
  12. $c->position = 'am';
  13. $c->label = 'Account manager';
  14. $test = array($a,$b,$c);
  15. $arr = (array)$test;
  16. var_dump($arr);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  object(stdClass)#1 (3) {
    ["id"]=>
    int(2)
    ["position"]=>
    string(2) "am"
    ["label"]=>
    string(15) "Account manager"
  }
  [1]=>
  object(stdClass)#2 (3) {
    ["id"]=>
    int(2)
    ["position"]=>
    string(2) "am"
    ["label"]=>
    string(15) "Account manager"
  }
  [2]=>
  object(stdClass)#3 (3) {
    ["id"]=>
    int(2)
    ["position"]=>
    string(2) "am"
    ["label"]=>
    string(15) "Account manager"
  }
}