note 114845 added to function.get-object-vars
| From: | lee dot howarth dot 90 at gmail dot com | Date: | Sun, 13 Apr 2014 10:48:40 +0000 |
| Subject: | note 114845 added to function.get-object-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199261@lists.php.net to get a copy of this message | ||
I find this function very helpful, What i wanted to do was to get the object properties of an
exception so i could sanitize them for output.
try
{
throw new Exception( 'Test Exception.', 100 );
}
catch( Exception $e )
{
var_dump( ( object ) get_object_vars( ( object ) ( new ArrayObject( $e ) ) ->
getarrayCopy() ) );
}
Example return:
object(stdClass)#10 (4) { ["message"]=> string(15) "Test Exception."
["code"]=> int(100) ["file"]=> string(29)
"C:\xampp\htdocs\dev\index.php" ["line"]=> int(19) }
----
Server IP: 72.52.91.14
Probable Submitter: 80.47.53.86
----
Manual Page -- http://php.net/manual/en/function.get-object-vars.php
Edit -- https://master.php.net/note/edit/114845
Del: integrated -- https://master.php.net/note/delete/114845/integrated
Del: useless -- https://master.php.net/note/delete/114845/useless
Del: bad code -- https://master.php.net/note/delete/114845/bad+code
Del: spam -- https://master.php.net/note/delete/114845/spam
Del: non-english -- https://master.php.net/note/delete/114845/non-english
Del: in docs -- https://master.php.net/note/delete/114845/in+docs
Del: other reasons-- https://master.php.net/note/delete/114845
Reject -- https://master.php.net/note/reject/114845
Search -- https://master.php.net/manage/user-notes.php