get the object to array format in php
<?php
class Point2D {
var $x, $y;
function Point2D($x, $y)
{
$this->x = $x;
$this->y = $y;
}
}
$p1 = new Point2D(1.233, 3.445);
echo “<pre>”;
print_r($p1); //print in object formate
echo “</pre>”;
echo “<pre>”;
print_r(get_object_vars($p1)); //print in array format
echo “</pre>”;
?>
_______________________________________________________________________________________
// ******************Output**********************************************
_______________________________________________________________________________________
Point2D Object
(
[x] => 1.233
[y] => 3.445
[label] =>
)
Array
(
[x] => 1.233
[y] => 3.445
[label] =>
)