====== Allgemeine Debugger Funktion ====== Das ist ein Script mit dem man nicht ständig ''
...'' Tags selbst schreiben muss und auch nicht immer ''var_dump()'' tippen muss. Die Funktion ist eher aus Faulheit entstanden, will aber nicht mehr drauf verzichten.
Ausgabe
*
* @return void
*/
function d( $obj, $title = false ){
echo "";
if( $title ) {
echo "" . $title . "
";
}
echo "";
var_dump( $obj );
echo "
";
echo "";
};
===== Optionales CSS Styling =====
Es kann schon auch Sinn machen, die Ausgabe der Debug-Funktion ein wenig zu stylen. Hier ein Beispiel CSS-Code der die Box in einen gelblichen "Message" hüllt:
.debug{
display : block;
margin : 22px;
padding : 11px;
max-width : calc( 100% - 44px );
background-color : rgb(255 245 225);
border-left : 11px solid rgb(255,200,0);
}
.debug__title{
margin : 0px 0px 22px 0px;
font-family : -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif;
font-weight : 600;
font-size : 18px;
line-height : 22px;
color : rgb(255,200,0);
text-shadow : 1px 1px 2px rgba(125,100,0,0.3);
}
.debug__print{
margin : 0px;
padding : 0px;
font-family : Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
color : rgb(90,90,90);
font-size : 12px;
line-height : 22px;
}