note 82399 added to function.print-r

From: Date: Wed, 09 Apr 2008 12:27:42 +0000
Subject: note 82399 added to function.print-r
Groups: php.notes 
Request: Send a blank email to php-notes+get-138059@lists.php.net to get a copy of this message
@highstrike at gmail dot com 08-Jan-2008 02:34 You have an bug in your debug script, the script only prints public properties of the exported object. If you want to export all object properties (public, private, protected) to an array, then simply cast the object to an array: <?php class some { public $pub = 1; protected $prot = 2; private $priv = 3; } var_dump( (array) new some() ); ?> result: -------------- array(3) { ["pub"]=> int(1) ["*prot"]=> int(2) ["somepriv"]=> int(3) } ---- Server IP: 83.137.20.135 Probable Submitter: 62.131.230.106 ---- Manual Page -- http://www.php.net/manual/en/function.print-r.php Edit -- https://master.php.net/note/edit/82399 Del: integrated -- https://master.php.net/note/delete/82399/integrated Del: useless -- https://master.php.net/note/delete/82399/useless Del: bad code -- https://master.php.net/note/delete/82399/bad+code Del: spam -- https://master.php.net/note/delete/82399/spam Del: non-english -- https://master.php.net/note/delete/82399/non-english Del: in docs -- https://master.php.net/note/delete/82399/in+docs Del: other reasons-- https://master.php.net/note/delete/82399 Reject -- https://master.php.net/note/reject/82399 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138059) next »