NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
code executed only when testing in the debugger


Joined: 17 Dec 2008
Posts: 4
Reply with quote
Hi All,

Is it possible to enter conditional code, that is only executed when testing in the debugger?
Something like:
IF OnTestMode then TestCode else Normalcode

Best regards,
Piet
View user's profileFind all posts by pvzSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
you may want to try something like this

Code:
function IsInDebugger() {
  return ((isset($_GET['DBGSESSID']) && (int)$_GET['DBGSESSID'] >= 0) ||
             (isset($_ENV['DBGSESSID']) && (int)$_ENV['DBGSESSID'] >= 0) ||
             (isset($_COOKIE['DBGSESSID']) && (int)$_COOKIE['DBGSESSID'] >= 0))
}

...

if (IsInDebugger()) ...

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 17 Dec 2008
Posts: 4
Reply with quote
Thanks, exactly what I needed.
View user's profileFind all posts by pvzSend private message
code executed only when testing in the debugger
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic