-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanonymous.php
More file actions
66 lines (35 loc) · 861 Bytes
/
anonymous.php
File metadata and controls
66 lines (35 loc) · 861 Bytes
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
<?php
// $func = function() {
// echo 'Hello';
// };
// $func();
class ParentClass {
public function hello() {
echo 'Hello<br/>';
}
}
class Route {
function __construct($func) {
$this->$func = $func;
}
public static function get($route , $method) {
//echo $route.' Route<br/>';
if(gettype($method) == 'object') {
$method();
} else if(gettype($method) == 'string') {
$methodArray = explode('@', $method);
if(sizeof($methodArray) > 1) {
$object = new $methodArray[0];
$object->$methodArray[1]();
}
else if(sizeof($methodArray) == 1) {
$method();
}
}
}
}
$id = 1;
Route::get('admin/users', function() use ($id){
echo 'Entered Anonymous Function'.$id.'<br/>';
});
Route::get('admin/users', 'ParentClass@hello');