forked from ospinto/dBug
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtests.php
112 lines (99 loc) · 2.3 KB
/
tests.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
namespace dBug\tests;
ini_set('display_errors', 1);
error_reporting(E_ALL ^E_NOTICE);
header('Content-Type: text/html;charset=utf-8;');
include_once(__DIR__.'/dBug.php');
use dBug\dBug;
$a="The quick brown fox jumps over the lazy dog";
//trying to modify
class myDBug extends dBug{
public static $embeddedStringMaxLength=10;
}
new dBug($a);
new myDBug($a);
new myDBug("test", "", true);
new dBug(
$a
);
$a="The quick brown fox jumps over the lazy dog\nThe five boxing wizards jump quickly.\r\nСъешь же ещё этих мягких французских булок, да выпей чаю\n";
new dBug($a);
$a='vodka';
new dBug($a);
$a=3;
new dBug($a);
$a=3.5;
new dBug($a);
$a=null;
new dBug($a);
$a=true;
new dBug($a);
$a=false;
new dBug($a);
$variable = array(
"first"=>"1",
"second",
"third"=>array(
"inner third 1",
"inner third 2"=>25),
"fourth"=>49.36,
'fifth'=>true,
6=>false,
null,
);
new dBug($variable);
class Vegetable {
public $edible;
public $color;
public function __construct($edible, $color="green") {
$this->edible = $edible;
$this->color = $color;
}
public function is_edible() {
return $this->edible;
}
public function what_color() {
return $this->color;
}
}
new dBug(new Vegetable("spinach"));
$a=curl_init("https://github.com/");
new dBug($a);
//curl_exec($a);
//new dBug($a);
class myExc extends \Exception{
private $priv="PREVED";
protected $ololo="trololol";
public $num=0;
public function __construct($msg) {
parent::__construct($msg);
$this->code=rand(0, 100);
}
};
try{
throw new myExc("MedVed");
}catch(\Exception $e){
new dBug($e);
}
try{
throw new \Exception("hahahahaha");
}catch(\Exception $e){
new dBug($e);
}
//drawing Sierpinsky triangle
//http://php.net/manual/en/function.imagesetpixel.php
{
$x = 200;
$y = 200;
$img = imagecreatetruecolor($x, $y);
$corners[0] = array('x' => 100, 'y' => 10);
$corners[1] = array('x' => 0, 'y' => 190);
$corners[2] = array('x' => 200, 'y' => 190);
for ($i = 0; $i < 10000; $i++) {
$a = rand(0, 2);
imagesetpixel($img, round($x), round($y), imagecolorallocate($img, 255*$x/190, 255*(1-$y/190), 255*$a/2));
$x = ($x + $corners[$a]['x']) / 2;
$y = ($y + $corners[$a]['y']) / 2;
}
new dBug($img);
}