php - How to throw an exception but include parameters as part of the message? -


what best way this:

$params = array ('a' => 'b', 'c' => 'd'); // etc etc  throw new exception(    "could not because params << insert parameters >> bad",       $code  ); 

what best way include parameters part of exception , if must go in message, best way transform text no details lost?

keep in mind, want see this:

"could not because params: = b, c = d bad",   

you can use sprintf function

throw new exception(    sprintf("could not because params %s, %s bad", 'b', 'd'),       $code  ); 

Comments

Popular posts from this blog

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -