/
fun3.php
68 lines (46 loc) · 888 Bytes
/
fun3.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
<?php
/*
function array_prefix_values($prefix, $array)
{
$callback = create_function('$str','return "'.$prefix.'".$str;');
return array_map($callback,$array);
}
//usage:
$dir = "./css/";
$files = scandir($dir);
$files = array_prefix_values($dir,$files);
print_r($files);
/*
//output:
(
[0] => ./css/.
[1] => ./css/..
[2] => ./css/default.css
[4] => ./css/helper.css
[6] => ./css/page_layout.css
)
*/
/*
error_reporting(E_ALL);
function increment(&$var)
{
$var++;
}
$a = 0;
call_user_func('increment', $a);
echo $a."\n";
call_user_func_array('increment', array(&$a)); // You can use this instead before PHP 5.3
echo $a."\n";
*/
$method_name = "AMethodName";
$obj = new ClassName();
$obj->{$method_name}();
?>
<?php
function __autoload($class_name) {
include $class_name . '.php';
}
$obj = new MyClass1();
$obj2 = new MyClass2();
?>
?>