Location: PHPKode > scripts > phpDebugger > debug_example.php
<?php
// * 
// * DebugExample.php - Shows how to implement
// * the OutputDebugString() which will
// * write information you specify to a debug
// * table in your database and that data
// * can be read back semi-real time so
// * you can see whats happening as
// * you work through a project.
// * 
// * Project was written by Phil Petree
// * and is available at philpetree.com
// * and is released under GNU license.
// * Copyright (C) 2010 by Phill Petree. All rights reserved worldwide.
// * US Governement users have restricted rights.
// *  
// * Ver 1.0 - Release date: June 22, 2010
// *

// pull in the OutputDebugString function 
include "debuginc.php";
include "../sqlinc.php";

function TestA($string1, $string2)
{
  OutputDebugString("TestA: started function");
  OutputDebugString("TestA: string1 = $string1");
  OutputDebugString("TestA: string2 = $string2");
  OutputDebugString("TestA: leaving function");
  return "$string1, $string2";
}

function TestB($n1, $n2)
{
  OutputDebugString("TestB: started function");
  $total = $n1 + $n2;
  OutputDebugString("TestB: Total of n1($n1) + n2 ($n2) is: $total");
  OutputDebugString("TestB: leaving function");  
  return $total;  
}
?>

<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="alternate" type="application/rss+xml" title="ROR" href="ror.xml">
<title>PHP Script Debugger</title>
<meta name="copyright" content="Phil Petree">
<meta name="publisher" content="http://www.philpetree.com/phpDebugger">
<meta name="abstract" content="Simple php debugger">
<meta name="author" content="Phil Petree">
<meta name="description" content="Simple PHP Debugger">
<meta name="Keywords"    content="php debugger, debug, debugging, php, OutputDebugString">
<meta name="revisit-after" content="1 day">
<meta name="robots" content="index, follow">
<link href="debugstyle.css" rel="stylesheet" type="text/css">

<!-- 
Duplicate description content here for search engine
 -->
 
</head>
<body> 
<center>
<h1>phpDebugger Sample Code</h1>
<h3>Click <a href='index.php' target='_new'>here!</a> to start debug output viewer</h3>
<?php

// create some strings
$szString1 = "Ft. Lauderdale";
$szString2 = "Florida";

// manipulate the strings 
$szLocation = TestA($szString1, $szString2);

// show the variable (#76 is the line #)
OutputDebugString("Variable (L#76): szLocation=$szLocation");

// lets do some math
$nTot = TestB(11, 37);

// Track the results
OutputDebugString("Variable (L#82): nTot=$nTot");
echo "Completed output to debug database!";
?>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<p>Copyright (c) 2010 by <a href='http://www.philpetree.com/phpdebug' target='_blank'>Phil Petree.</a> All rights reserved worldwide.</p>
</center>
</body>
</html>
Return current item: phpDebugger