-
Notifications
You must be signed in to change notification settings - Fork 6
/
11.php
78 lines (57 loc) · 1.03 KB
/
11.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
<?php
/**
* Created by PhpStorm.
* User: zhangyue
* Date: 2016/11/30
* Time: 上午9:12
*/
//debug函数
function debug(){
$numargs = func_num_args();
$arg_list = func_get_args();
for($i=0;$i<$numargs;$i++){
echo "第${i}个变量的值为:",$arg_list[$i],PHP_EOL;
}
echo '当前所处的文件名为:',__FILE__,PHP_EOL;
}
function factorl($n){
$factor = 1;
for($i=1;$i<$n;$i++){
$factor*=i;
debug($factor,$i);
}
return $factor;
}
factorl(4);
//debug_zval_dump
$debugArray = array(1,2,3);
foreach($debugArray as $v) {
$v *= 2;
debug_zval_dump($v);
}
var_dump($debugArray);
$debugArray2 = array(1,2,3);
foreach($debugArray2 as $v) {
$v *= 2;
debug_zval_dump($v);
}
var_dump($debugArray2);
//debug_print_backtrace
function a(){
b();
}
function b(){
c();
}
function c(){
debug_print_backtrace();
}
a();
//JMeter压力测试
$num = 4;
if(isset($_POST['num'])) $num = $_POST['num'];
$sum = 0;
for($i=0;$i<=$num;$i++){
$sum+=$i;
}
echo $sum;