Re: Object to array conversion oddity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 Sep 2006, at 01:09, Robert Cummings wrote:

It's broken, it doesn't preserve references.

<?php
class A {
private $A;
}
class B extends A {
private $A;
public $B;
protected $c;}
$a = new B;
$b = new B;
$b->B = $a;
var_dump(object2array($b));
?>

array(3) {
  ["A"]=>
  NULL
  ["B"]=>
  object(B)#1 (4) {
    ["A:private"]=>
    NULL
    ["B"]=>
    NULL
    ["c:protected"]=>
    NULL
    ["A:private"]=>
    NULL
  }
  ["c"]=>
  NULL
}

Reference preserved. It's not like I care about PHP4, nor am I doing a deep conversion.

Marcus
--
Marcus Bointon
Synchromedia Limited: Creators of http://www.smartmessages.net/
marcus@xxxxxxxxxxxxxxxxxx | http://www.synchromedia.co.uk/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux