note 114365 added to class.com

From: Date: Wed, 12 Feb 2014 21:59:54 +0000
Subject: note 114365 added to class.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-198483@lists.php.net to get a copy of this message
All the examples here show <?php $var = new COM('Whatever.Something') or die(); ?> however the 'or die()' bit is redundant as a fatal 'com_exception' exception will be thrown, killing your script. If you want to handle the 'or' condition you need to catch the exception, eg <?php try { $var = new COM('Whatever.Something'); } catch (com_exception $e) { //couldn't load, do something else like register exec('regsvr32 /s whatever.dll'); } ?> ---- Server IP: 202.78.240.39 Probable Submitter: 131.203.245.222 ---- Manual Page -- http://php.net/manual/en/class.com.php Edit -- https://master.php.net/note/edit/114365 Del: integrated -- https://master.php.net/note/delete/114365/integrated Del: useless -- https://master.php.net/note/delete/114365/useless Del: bad code -- https://master.php.net/note/delete/114365/bad+code Del: spam -- https://master.php.net/note/delete/114365/spam Del: non-english -- https://master.php.net/note/delete/114365/non-english Del: in docs -- https://master.php.net/note/delete/114365/in+docs Del: other reasons-- https://master.php.net/note/delete/114365 Reject -- https://master.php.net/note/reject/114365 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198483) next »