PHP code example of hazardland / debug

1. Go to this page and download the library: Download hazardland/debug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hazardland / debug example snippets


	class test1
	{
		public $string = "Test string";
		public $boolean = true;
		public $integer = 17;
		public $float = 9.99;
		public $array = array ('bob'=>'alice',true=>false,1=>5,2=>1.4);
		public $object;
	}

	class test2
	{
		public $another;
	}

	class test3
	{
		public $string1 = "3d level";
		public $string2 = "123";
		public $complicated;
	}

	class test4
	{
		public $enough = "Level 4";
		public $something = "Thanks for the fish!";
	}

	$test = new test1 ();
	$test->object = new test2();
	$test->object->another = new test3 ();
	$test->object->another->complicated = new test4 ();

	debug ($test);

	debug ($test, true);

	$pi = 3.14159265359;
	debug ($pi, "hello this is pi");

	$hm = array (1=>array(2=>array(3=>array(4=>array(5=>array(6=>array(7=>array(8=>"Last depth we created"))))))));
	debug ($hm, "* A very complicated expanded array");

debug ($hm, "* More levels", false, 10);

debug ($test, "Output something as plain text", true);

Output something as plain text
-------------------
string : "Test string"
boolean : true
integer : 17
float : 9.99
array (array)
    bob : "alice"
    1 : 5
    2 : 1.4
object (test2)
    another (test3)
        string1 : "3d level"
        string2 : "123"
        complicated (test4)
            enough : "Level 4"


debug ($test, date('Y-m-d H:i:s').": Save plain text to file ", "./test.log");

	debug ($_GET,'GET','error_log');