<?php

include('Debug2JsConsole.php');

class Foo {

    public $dings ='bum';
    public $bums  = '';
    
    function __construct() {
      $this -> bums = $this -> bums();
    }
    
    function bums($string='Peng!') {
        $this -> bums = $string;
        return $string;
    }
}

$foo = new Foo;
$foo -> bums('Kr"ach') . "\n";
$text = "Hallo Welt!";
$zahl = 100;
$arr  = ["Hüh", "Hot"];
$hash['FOO'] = 'Bar';
$hash['BAR'] = 'Foo';

?><!doctype html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Test für Debug2JsConsole</title>
    </head>
    <body>
        <h1>Test für Debug2JsConsole</h1>
        <p>Die Ausgaben finden sich in den Entwicklertools Ihres Browsers. Sie können diese wie folgt aufrufen:</p>
        <ul>
            <li>Firefox: [STRG] + [SHIFT] * [K]</li>
            <li>Chromium: [STRG] + [SHIFT] * [I]</li>
            <li>IE / Edge: [F12]</li>
        </ul>
        <?=Debug2JsConsole( $foo, '$foo',   'Typ: Objekt' );?>
        <?=Debug2JsConsole( $text, '$text', 'Typ: Text' );?>
        <?=Debug2JsConsole( $zahl, '$zahl', 'Typ: Zahl' );?>
        <?=Debug2JsConsole( $arr,  '$arr',  'Typ: Array' );?>
        <?=Debug2JsConsole( $hash,  '$hash','Typ: Hash' );?>
        <?=Debug2JsConsole( __DIR__,  '__DIR__' , 'Typ: MAGIC VAR');?>
        <?php
            error_reporting( 0 ); 
            echo Debug2JsConsole( $unknown,  '$unknown', 'Typ: UNSET VAR' );
            
            $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
            Debug2JsConsole( $mysqli->connect_error,  '$mysqli->connect_error' , 'Typ: MySQLi-Connect-Error');
        ?>
    </body>
</html>