Array of Error Codes: Key/Values

From: Date: Wed, 16 Mar 2011 17:00:10 +0000
Subject: Array of Error Codes: Key/Values
Groups: php.general 
Request: Send a blank email to php-general+get-311888@lists.php.net to get a copy of this message
Hi, I'm new to php and i'm looking to setup an array (or what work best) of codes and corresponding error strings, for example (pseudo code): ERROR_CODES = array('-1' => 'Error opening file', '-2' => 'General File IO Error', '-3' => 'Database connection error'); Access these string values using the key codes (negative key values) to formulate a SoapFault, e.g.: throw new SoapFault('-1', ERROR_CODES[-1], 'actor', 'detail', 'name', 'header'); How best to implement this in php? Thanks, Brendan

« previous php.general (#311888) next »